diff --git a/projects/PicoBlaze/ise/Assembler/CONSTANT.TXT b/projects/PicoBlaze/ise/Assembler/CONSTANT.TXT new file mode 100644 index 0000000..fae0ee3 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/CONSTANT.TXT @@ -0,0 +1,111 @@ +Table of constant values and their specified constant labels. + +00 UART_status_port +01 tx_half_full +02 tx_full +04 rx_half_full +08 rx_full +10 rx_data_present +01 UART_read_port +01 UART_write_port +00 alarm_port +01 alarm_control +00 us_time_stamp_lsb +01 us_time_stamp_msb +02 us_time_lsb +03 us_time_msb +04 ms_time_lsb +05 ms_time_msb +06 real_time_hours +07 real_time_minutes +08 real_time_seconds +09 alarm_time_hours +0A alarm_time_minutes +0B alarm_time_seconds +0C alarm_status +01 alarm_active +02 alarm_armed +10 time_preserve0 +11 time_preserve1 +12 time_preserve2 +13 time_preserve3 +14 time_preserve4 +15 time_preserve5 +20 string_start +E8 count_1000_lsb +03 count_1000_msb +18 hours_in_a_day +3C minutes_in_an_hour +3C seconds_in_a_minute +61 character_a +62 character_b +63 character_c +64 character_d +65 character_e +66 character_f +67 character_g +68 character_h +69 character_i +6A character_j +6B character_k +6C character_l +6D character_m +6E character_n +6F character_o +70 character_p +71 character_q +72 character_r +73 character_s +74 character_t +75 character_u +76 character_v +77 character_w +78 character_x +79 character_y +7A character_z +41 character_A +42 character_B +43 character_C +44 character_D +45 character_E +46 character_F +47 character_G +48 character_H +49 character_I +4A character_J +4B character_K +4C character_L +4D character_M +4E character_N +4F character_O +50 character_P +51 character_Q +52 character_R +53 character_S +54 character_T +55 character_U +56 character_V +57 character_W +58 character_X +59 character_Y +5A character_Z +30 character_0 +31 character_1 +32 character_2 +33 character_3 +34 character_4 +35 character_5 +36 character_6 +37 character_7 +38 character_8 +39 character_9 +3A character_colon +3B character_semi_colon +3C character_less_than +3E character_greater_than +3D character_equals +20 character_space +0D character_CR +3F character_question +24 character_dollar +08 character_BS diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.COE b/projects/PicoBlaze/ise/Assembler/INT_TEST.COE new file mode 100644 index 0000000..4715f6a --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.COE @@ -0,0 +1,92 @@ +component_name=int_test; +width_a=18; +depth_a=1024; +configuration_port_a=read_only; +port_a_enable_pin=false; +port_a_handshaking_pins=false; +port_a_register_inputs=false; +port_a_init_pin=false; +port_a_init_value=00000; +port_a_additional_output_pipe_stages = 0; +port_a_register_inputs = false; +port_a_active_clock_edge = Rising_Edge_Triggered; +width_b=18; +depth_b=1024; +configuration_port_b=read_and_write; +write_mode_port_b=read_after_write; +port_b_enable_pin=false; +port_b_handshaking_pins=false; +port_b_register_inputs=false; +port_b_init_pin=false; +port_b_init_value=00000; +port_b_additional_output_pipe_stages = 0; +port_b_register_inputs = false; +port_b_active_clock_edge = Rising_Edge_Triggered; +port_b_write_enable_polarity = Active_High; +memory_initialization_radix=16; +global_init_value=00000; +memory_initialization_vector= +00A00, 002AA, 3C001, 2C202, 00007, 1C001, 35405, 0E2FF, 34003, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +18A01, 2CA04, 38001, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 342B0; diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.DEC b/projects/PicoBlaze/ise/Assembler/INT_TEST.DEC new file mode 100644 index 0000000..39f6c82 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.DEC @@ -0,0 +1,1024 @@ + 2560 + 682 + 245761 + 180738 + 7 + 114689 + 218117 + 58111 + 212995 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 100865 + 182788 + 229377 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 213680 diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.FMT b/projects/PicoBlaze/ise/Assembler/INT_TEST.FMT new file mode 100644 index 0000000..3e2278a --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.FMT @@ -0,0 +1,25 @@ + ;Interrupt example + ; + CONSTANT waveform_port, 02 ;bit0 will be data + CONSTANT counter_port, 04 + CONSTANT pattern_10101010, AA + NAMEREG sA, interrupt_counter + ; + start: LOAD interrupt_counter, 00 ;reset interrupt counter + LOAD s2, pattern_10101010 ;initial output condition + ENABLE INTERRUPT + ; + drive_wave: OUTPUT s2, waveform_port + LOAD s0, 07 ;delay size + loop: SUB s0, 01 ;delay loop + JUMP NZ, loop + XOR s2, FF ;toggle waveform + JUMP drive_wave + ; + ADDRESS 2B0 +int_routine: ADD interrupt_counter, 01 ;increment counter + OUTPUT interrupt_counter, counter_port + RETURNI ENABLE + ; + ADDRESS 3FF ;set interrupt vector + JUMP int_routine diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.HEX b/projects/PicoBlaze/ise/Assembler/INT_TEST.HEX new file mode 100644 index 0000000..8f05a13 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.HEX @@ -0,0 +1,1024 @@ +00A00 +002AA +3C001 +2C202 +00007 +1C001 +35405 +0E2FF +34003 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +18A01 +2CA04 +38001 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +342B0 diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.LOG b/projects/PicoBlaze/ise/Assembler/INT_TEST.LOG new file mode 100644 index 0000000..eb68057 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.LOG @@ -0,0 +1,32 @@ +KCPSM3 Assembler log file for program 'int_test.psm'. +Generated by KCPSM3 version 1.30 +Ken Chapman (Xilinx Ltd) 2005. +25Sep2005-14:54:47 + + Addr Code + + 000 ;Interrupt example + 000 ; + 000 CONSTANT waveform_port, 02 ;bit0 will be data + 000 CONSTANT counter_port, 04 + 000 CONSTANT pattern_10101010, AA + 000 NAMEREG sA, interrupt_counter + 000 ; + 000 00A00 start: LOAD interrupt_counter[sA], 00 ;reset interrupt counter + 001 002AA LOAD s2, pattern_10101010[AA] ;initial output condition + 002 3C001 ENABLE INTERRUPT + 003 ; + 003 2C202 drive_wave: OUTPUT s2, waveform_port[02] + 004 00007 LOAD s0, 07 ;delay size + 005 1C001 loop: SUB s0, 01 ;delay loop + 006 35405 JUMP NZ, loop[005] + 007 0E2FF XOR s2, FF ;toggle waveform + 008 34003 JUMP drive_wave[003] + 009 ; + 2B0 ADDRESS 2B0 + 2B0 18A01 int_routine: ADD interrupt_counter[sA], 01 ;increment counter + 2B1 2CA04 OUTPUT interrupt_counter[sA], counter_port[04] + 2B2 38001 RETURNI ENABLE + 2B3 ; + 3FF ADDRESS 3FF ;set interrupt vector + 3FF 342B0 JUMP int_routine[2B0] diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.M b/projects/PicoBlaze/ise/Assembler/INT_TEST.M new file mode 100644 index 0000000..be3b6c2 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.M @@ -0,0 +1,69 @@ +function bits = fill_int_test_program_store() + bits = [ ... + 2560, 682, 245761, 180738, 7, 114689, 218117, 58111, 212995, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 100865, 182788, 229377, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 213680, ... + ]; + + return; diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.MEM b/projects/PicoBlaze/ise/Assembler/INT_TEST.MEM new file mode 100644 index 0000000..a94f925 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.MEM @@ -0,0 +1,1025 @@ +@00000000 +00A00 +002AA +3C001 +2C202 +00007 +1C001 +35405 +0E2FF +34003 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +18A01 +2CA04 +38001 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +342B0 diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.V b/projects/PicoBlaze/ise/Assembler/INT_TEST.V new file mode 100644 index 0000000..5c399f9 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.V @@ -0,0 +1,262 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2004 Xilinx, Inc. +// All Rights Reserved +//////////////////////////////////////////////////////////////////////////////// +// ____ ____ +// / /\/ / +// /___/ \ / Vendor: Xilinx +// \ \ \/ Version: v1.30 +// \ \ Application : KCPSM3 +// / / Filename: int_test.v +// /___/ /\ +// \ \ / \ +// \___\/\___\ +// +//Command: kcpsm3 int_test.psm +//Device: Spartan-3, Spartan-3E, Virtex-II, and Virtex-II Pro FPGAs +//Design Name: int_test +//Generated 25Sep2005-14:54:47. +//Purpose: +// int_test verilog program definition. +// +//Reference: +// PicoBlaze 8-bit Embedded Microcontroller User Guide +//////////////////////////////////////////////////////////////////////////////// +`timescale 1 ps / 1ps +module int_test (address, instruction, clk); +input [9:0] address; +input clk; +output [17:0] instruction; +RAMB16_S18 ram_1024_x_18( + .DI (16'h0000), + .DIP (2'b00), + .EN (1'b1), + .WE (1'b0), + .SSR (1'b0), + .CLK (clk), + .ADDR (address), + .DO (instruction[15:0]), + .DOP (instruction[17:16])) +/*synthesis +init_00 = "00000000000000000000000000004003E2FF5405C0010007C202C00102AA0A00" +init_01 = "0000000000000000000000000000000000000000000000000000000000000000" +init_02 = "0000000000000000000000000000000000000000000000000000000000000000" +init_03 = "0000000000000000000000000000000000000000000000000000000000000000" +init_04 = "0000000000000000000000000000000000000000000000000000000000000000" +init_05 = "0000000000000000000000000000000000000000000000000000000000000000" +init_06 = "0000000000000000000000000000000000000000000000000000000000000000" +init_07 = "0000000000000000000000000000000000000000000000000000000000000000" +init_08 = "0000000000000000000000000000000000000000000000000000000000000000" +init_09 = "0000000000000000000000000000000000000000000000000000000000000000" +init_0A = "0000000000000000000000000000000000000000000000000000000000000000" +init_0B = "0000000000000000000000000000000000000000000000000000000000000000" +init_0C = "0000000000000000000000000000000000000000000000000000000000000000" +init_0D = "0000000000000000000000000000000000000000000000000000000000000000" +init_0E = "0000000000000000000000000000000000000000000000000000000000000000" +init_0F = "0000000000000000000000000000000000000000000000000000000000000000" +init_10 = "0000000000000000000000000000000000000000000000000000000000000000" +init_11 = "0000000000000000000000000000000000000000000000000000000000000000" +init_12 = "0000000000000000000000000000000000000000000000000000000000000000" +init_13 = "0000000000000000000000000000000000000000000000000000000000000000" +init_14 = "0000000000000000000000000000000000000000000000000000000000000000" +init_15 = "0000000000000000000000000000000000000000000000000000000000000000" +init_16 = "0000000000000000000000000000000000000000000000000000000000000000" +init_17 = "0000000000000000000000000000000000000000000000000000000000000000" +init_18 = "0000000000000000000000000000000000000000000000000000000000000000" +init_19 = "0000000000000000000000000000000000000000000000000000000000000000" +init_1A = "0000000000000000000000000000000000000000000000000000000000000000" +init_1B = "0000000000000000000000000000000000000000000000000000000000000000" +init_1C = "0000000000000000000000000000000000000000000000000000000000000000" +init_1D = "0000000000000000000000000000000000000000000000000000000000000000" +init_1E = "0000000000000000000000000000000000000000000000000000000000000000" +init_1F = "0000000000000000000000000000000000000000000000000000000000000000" +init_20 = "0000000000000000000000000000000000000000000000000000000000000000" +init_21 = "0000000000000000000000000000000000000000000000000000000000000000" +init_22 = "0000000000000000000000000000000000000000000000000000000000000000" +init_23 = "0000000000000000000000000000000000000000000000000000000000000000" +init_24 = "0000000000000000000000000000000000000000000000000000000000000000" +init_25 = "0000000000000000000000000000000000000000000000000000000000000000" +init_26 = "0000000000000000000000000000000000000000000000000000000000000000" +init_27 = "0000000000000000000000000000000000000000000000000000000000000000" +init_28 = "0000000000000000000000000000000000000000000000000000000000000000" +init_29 = "0000000000000000000000000000000000000000000000000000000000000000" +init_2A = "0000000000000000000000000000000000000000000000000000000000000000" +init_2B = "00000000000000000000000000000000000000000000000000008001CA048A01" +init_2C = "0000000000000000000000000000000000000000000000000000000000000000" +init_2D = "0000000000000000000000000000000000000000000000000000000000000000" +init_2E = "0000000000000000000000000000000000000000000000000000000000000000" +init_2F = "0000000000000000000000000000000000000000000000000000000000000000" +init_30 = "0000000000000000000000000000000000000000000000000000000000000000" +init_31 = "0000000000000000000000000000000000000000000000000000000000000000" +init_32 = "0000000000000000000000000000000000000000000000000000000000000000" +init_33 = "0000000000000000000000000000000000000000000000000000000000000000" +init_34 = "0000000000000000000000000000000000000000000000000000000000000000" +init_35 = "0000000000000000000000000000000000000000000000000000000000000000" +init_36 = "0000000000000000000000000000000000000000000000000000000000000000" +init_37 = "0000000000000000000000000000000000000000000000000000000000000000" +init_38 = "0000000000000000000000000000000000000000000000000000000000000000" +init_39 = "0000000000000000000000000000000000000000000000000000000000000000" +init_3A = "0000000000000000000000000000000000000000000000000000000000000000" +init_3B = "0000000000000000000000000000000000000000000000000000000000000000" +init_3C = "0000000000000000000000000000000000000000000000000000000000000000" +init_3D = "0000000000000000000000000000000000000000000000000000000000000000" +init_3E = "0000000000000000000000000000000000000000000000000000000000000000" +init_3F = "42B0000000000000000000000000000000000000000000000000000000000000" +initp_00 = "00000000000000000000000000000000000000000000000000000000000334B0" +initp_01 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_02 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_03 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_04 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_05 = "0000000000000000000000000000000000000039000000000000000000000000" +initp_06 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_07 = "C000000000000000000000000000000000000000000000000000000000000000" */; +// synthesis translate_off +// Attributes for Simulation +defparam ram_1024_x_18.INIT_00 = 256'h00000000000000000000000000004003E2FF5405C0010007C202C00102AA0A00; +defparam ram_1024_x_18.INIT_01 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_02 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_03 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_04 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_05 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_06 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_07 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_08 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_09 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_0A = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_0B = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_0C = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_0D = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_0E = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_0F = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_10 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_11 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_12 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_13 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_14 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_15 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_16 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_17 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_18 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_19 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_1A = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_1B = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_1C = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_1D = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_1E = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_1F = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_20 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_21 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_22 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_23 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_24 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_25 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_26 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_27 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_28 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_29 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2A = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2B = 256'h00000000000000000000000000000000000000000000000000008001CA048A01; +defparam ram_1024_x_18.INIT_2C = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2D = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2E = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2F = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_30 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_31 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_32 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_33 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_34 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_35 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_36 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_37 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_38 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_39 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3A = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3B = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3C = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3D = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3E = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3F = 256'h42B0000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_00 = 256'h00000000000000000000000000000000000000000000000000000000000334B0; +defparam ram_1024_x_18.INITP_01 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_02 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_03 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_04 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_05 = 256'h0000000000000000000000000000000000000039000000000000000000000000; +defparam ram_1024_x_18.INITP_06 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_07 = 256'hC000000000000000000000000000000000000000000000000000000000000000; +// synthesis translate_on +// Attributes for XST (Synplicity attributes are in-line) +// synthesis attribute INIT_00 of ram_1024_x_18 is "00000000000000000000000000004003E2FF5405C0010007C202C00102AA0A00" +// synthesis attribute INIT_01 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_02 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_03 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_04 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_05 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_06 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_07 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_08 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_09 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_0A of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_0B of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_0C of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_0D of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_0E of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_0F of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_10 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_11 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_12 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_13 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_14 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_15 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_16 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_17 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_18 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_19 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_1A of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_1B of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_1C of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_1D of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_1E of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_1F of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_20 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_21 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_22 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_23 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_24 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_25 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_26 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_27 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_28 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_29 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2A of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2B of ram_1024_x_18 is "00000000000000000000000000000000000000000000000000008001CA048A01" +// synthesis attribute INIT_2C of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2D of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2E of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2F of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_30 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_31 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_32 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_33 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_34 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_35 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_36 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_37 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_38 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_39 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3A of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3B of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3C of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3D of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3E of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3F of ram_1024_x_18 is "42B0000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_00 of ram_1024_x_18 is "00000000000000000000000000000000000000000000000000000000000334B0" +// synthesis attribute INITP_01 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_02 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_03 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_04 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_05 of ram_1024_x_18 is "0000000000000000000000000000000000000039000000000000000000000000" +// synthesis attribute INITP_06 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_07 of ram_1024_x_18 is "C000000000000000000000000000000000000000000000000000000000000000" +endmodule +// END OF FILE int_test.v diff --git a/projects/PicoBlaze/ise/Assembler/INT_TEST.VHD b/projects/PicoBlaze/ise/Assembler/INT_TEST.VHD new file mode 100644 index 0000000..48ab89f --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/INT_TEST.VHD @@ -0,0 +1,274 @@ +-- +-- Definition of a single port ROM for KCPSM3 program defined by int_test.psm +-- +-- Generated by KCPSM3 Assembler 25Sep2005-14:54:47. +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library unisim; +use unisim.vcomponents.all; +-- +-- +entity int_test is + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end int_test; +-- +architecture low_level_definition of int_test is +-- +-- Attributes to define ROM contents during implementation synthesis. +-- The information is repeated in the generic map for functional simulation +-- +attribute INIT_00 : string; +attribute INIT_01 : string; +attribute INIT_02 : string; +attribute INIT_03 : string; +attribute INIT_04 : string; +attribute INIT_05 : string; +attribute INIT_06 : string; +attribute INIT_07 : string; +attribute INIT_08 : string; +attribute INIT_09 : string; +attribute INIT_0A : string; +attribute INIT_0B : string; +attribute INIT_0C : string; +attribute INIT_0D : string; +attribute INIT_0E : string; +attribute INIT_0F : string; +attribute INIT_10 : string; +attribute INIT_11 : string; +attribute INIT_12 : string; +attribute INIT_13 : string; +attribute INIT_14 : string; +attribute INIT_15 : string; +attribute INIT_16 : string; +attribute INIT_17 : string; +attribute INIT_18 : string; +attribute INIT_19 : string; +attribute INIT_1A : string; +attribute INIT_1B : string; +attribute INIT_1C : string; +attribute INIT_1D : string; +attribute INIT_1E : string; +attribute INIT_1F : string; +attribute INIT_20 : string; +attribute INIT_21 : string; +attribute INIT_22 : string; +attribute INIT_23 : string; +attribute INIT_24 : string; +attribute INIT_25 : string; +attribute INIT_26 : string; +attribute INIT_27 : string; +attribute INIT_28 : string; +attribute INIT_29 : string; +attribute INIT_2A : string; +attribute INIT_2B : string; +attribute INIT_2C : string; +attribute INIT_2D : string; +attribute INIT_2E : string; +attribute INIT_2F : string; +attribute INIT_30 : string; +attribute INIT_31 : string; +attribute INIT_32 : string; +attribute INIT_33 : string; +attribute INIT_34 : string; +attribute INIT_35 : string; +attribute INIT_36 : string; +attribute INIT_37 : string; +attribute INIT_38 : string; +attribute INIT_39 : string; +attribute INIT_3A : string; +attribute INIT_3B : string; +attribute INIT_3C : string; +attribute INIT_3D : string; +attribute INIT_3E : string; +attribute INIT_3F : string; +attribute INITP_00 : string; +attribute INITP_01 : string; +attribute INITP_02 : string; +attribute INITP_03 : string; +attribute INITP_04 : string; +attribute INITP_05 : string; +attribute INITP_06 : string; +attribute INITP_07 : string; +-- +-- Attributes to define ROM contents during implementation synthesis. +-- +attribute INIT_00 of ram_1024_x_18 : label is "00000000000000000000000000004003E2FF5405C0010007C202C00102AA0A00"; +attribute INIT_01 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_02 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_03 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_04 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_05 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_06 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_07 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_08 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_09 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_0A of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_0B of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_0C of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_0D of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_0E of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_0F of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_10 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_11 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_12 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_13 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_14 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_15 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_16 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_17 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_18 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_19 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_1A of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_1B of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_1C of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_1D of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_1E of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_1F of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_20 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_21 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_22 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_23 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_24 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_25 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_26 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_27 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_28 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_29 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2A of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2B of ram_1024_x_18 : label is "00000000000000000000000000000000000000000000000000008001CA048A01"; +attribute INIT_2C of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2D of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2E of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2F of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_30 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_31 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_32 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_33 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_34 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_35 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_36 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_37 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_38 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_39 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3A of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3B of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3C of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3D of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3E of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3F of ram_1024_x_18 : label is "42B0000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_00 of ram_1024_x_18 : label is "00000000000000000000000000000000000000000000000000000000000334B0"; +attribute INITP_01 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_02 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_03 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_04 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_05 of ram_1024_x_18 : label is "0000000000000000000000000000000000000039000000000000000000000000"; +attribute INITP_06 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_07 of ram_1024_x_18 : label is "C000000000000000000000000000000000000000000000000000000000000000"; +-- +begin +-- + --Instantiate the Xilinx primitive for a block RAM + ram_1024_x_18: RAMB16_S18 + --synthesis translate_off + --INIT values repeated to define contents for functional simulation + generic map ( INIT_00 => X"00000000000000000000000000004003E2FF5405C0010007C202C00102AA0A00", + INIT_01 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_02 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_03 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_04 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_05 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_06 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_07 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_08 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_09 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_0A => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_0D => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_0E => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_0F => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_10 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_11 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_12 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_13 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_14 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_15 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_16 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_17 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_18 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_19 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_1A => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_1B => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_1C => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_1D => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_1E => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_1F => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_20 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_21 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_22 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_23 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_24 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_25 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_26 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_27 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_28 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_29 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2A => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2B => X"00000000000000000000000000000000000000000000000000008001CA048A01", + INIT_2C => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2D => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2E => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2F => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_30 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_31 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_32 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_33 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_34 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_35 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_36 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_37 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_38 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_39 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3A => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3B => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3C => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3D => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3E => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3F => X"42B0000000000000000000000000000000000000000000000000000000000000", + INITP_00 => X"00000000000000000000000000000000000000000000000000000000000334B0", + INITP_01 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_02 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_03 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_04 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_05 => X"0000000000000000000000000000000000000039000000000000000000000000", + INITP_06 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_07 => X"C000000000000000000000000000000000000000000000000000000000000000") + --synthesis translate_on + port map( DI => "0000000000000000", + DIP => "00", + EN => '1', + WE => '0', + SSR => '0', + CLK => clk, + ADDR => address, + DO => instruction(15 downto 0), + DOP => instruction(17 downto 16)); +-- +end low_level_definition; +-- +------------------------------------------------------------------------------------ +-- +-- END OF FILE int_test.vhd +-- +------------------------------------------------------------------------------------ diff --git a/projects/PicoBlaze/ise/Assembler/KCPSM3.EXE b/projects/PicoBlaze/ise/Assembler/KCPSM3.EXE new file mode 100644 index 0000000..fb0035d Binary files /dev/null and b/projects/PicoBlaze/ise/Assembler/KCPSM3.EXE differ diff --git a/projects/PicoBlaze/ise/Assembler/LABELS.TXT b/projects/PicoBlaze/ise/Assembler/LABELS.TXT new file mode 100644 index 0000000..9d851ee --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/LABELS.TXT @@ -0,0 +1,63 @@ +Table of addresses and their specified labels. + +000 cold_start +012 prompt_input +01C bad_input_command +01E test_for_TIME +02C set_time_command +037 test_for_ALARM +048 set_alarm_command +055 set_alarm_on_off +060 test_OFF +06D test_time_string +08B invalid_time +091 fetch_char_from_memory +095 read_from_UART +09A read_character +09D send_to_UART +0A2 UART_write +0A4 alarm_drive +0A8 transmit_time +0AC transmit_alarm_time +0B6 test_armed +0BA alarm_is_off +0BC transmit_string +0BD next_char_tx +0C3 receive_string +0C6 receive_full_test +0D3 BS_edit +0D9 string_start_again +0DB read_error +0DF clear_UART_Rx_loop +0E4 send_CR +0E7 send_space +0EA send_backspace +0ED send_Syntax_Error +0FA send_Overflow_Error +10A send_space_Error +10B send_Error +115 send_prompt +122 send_greater_than +125 send_Invalid +134 send_Time +13D send_Alarm +148 send_OFF +14E send_ON +153 send_Active +160 time_to_ASCII +17E decimal_to_ASCII +17F test_for_ten +185 update_time +19A test_1000us +19F store_us_time +1AD restore_ms_time +1AF store_ms_time +1B7 inc_minutes +1BF inc_hours +1C7 reset_hours +1C9 time_update_complete +1DB finish_update +1E2 upper_case +1E8 1char_to_value +1EC 2char_to_value +3FC ISR diff --git a/projects/PicoBlaze/ise/Assembler/PASS1.DAT b/projects/PicoBlaze/ise/Assembler/PASS1.DAT new file mode 100644 index 0000000..e5fc484 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/PASS1.DAT @@ -0,0 +1,5040 @@ + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;KCPSM3 Program - Real Time Clock with UART communication. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Ken Chapman - Xilinx Ltd - October 2003 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Port definitions + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_status_port + OPERAND2-00 + COMMENT-;UART status input + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_half_full + OPERAND2-01 + COMMENT-; Transmitter half full - bit0 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_full + OPERAND2-02 + COMMENT-; FIFO full - bit1 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_half_full + OPERAND2-04 + COMMENT-; Receiver half full - bit2 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_full + OPERAND2-08 + COMMENT-; FIFO full - bit3 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_data_present + OPERAND2-10 + COMMENT-; data present - bit4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_read_port + OPERAND2-01 + COMMENT-;UART Rx data input + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_write_port + OPERAND2-01 + COMMENT-;UART Tx data output + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_port + OPERAND2-00 + COMMENT-;Alarm output + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_control + OPERAND2-01 + COMMENT-; bit0 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Special Register usage + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sF + OPERAND2-UART_data + COMMENT-;used to pass data to and from the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sE + OPERAND2-store_pointer + COMMENT-;used to pass location of data in scratch pad memory + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Two registers to form a 16-bit counter used to count + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;interrupt pulses generated at 1us intervals. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sD + OPERAND2-int_counter_lsb + COMMENT-;lower 8-bits + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sC + OPERAND2-int_counter_msb + COMMENT-;upper 8-bits + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Scratch Pad Memory Locations + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_lsb + OPERAND2-00 + COMMENT-;16-bit micro-second time stamp + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_msb + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_lsb + OPERAND2-02 + COMMENT-;16-bit micro-second real time value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_msb + OPERAND2-03 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_lsb + OPERAND2-04 + COMMENT-;16-bit milli-second real time value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_msb + OPERAND2-05 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_hours + OPERAND2-06 + COMMENT-;Current clock time + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_minutes + OPERAND2-07 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_seconds + OPERAND2-08 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_hours + OPERAND2-09 + COMMENT-;Alarm time + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_minutes + OPERAND2-0A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_seconds + OPERAND2-0B + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_status + OPERAND2-0C + COMMENT-;Alarm status + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_active + OPERAND2-01 + COMMENT-; bit0 - Alarm is active + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_armed + OPERAND2-02 + COMMENT-; bit1 - Alarm is armed + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve0 + OPERAND2-10 + COMMENT-;storage for protection of registers + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve1 + OPERAND2-11 + COMMENT-;used by the real time clock routine. + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve2 + OPERAND2-12 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve3 + OPERAND2-13 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve4 + OPERAND2-14 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve5 + OPERAND2-15 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;UART character strings will be stored in scratch pad memory ending in carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A string can be up to 16 characters with the start location defined by this constant. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-string_start + OPERAND2-20 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Initialise the system + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-cold_start +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;clear all time values + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_stamp_lsb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_stamp_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_lsb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_lsb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_seconds + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_seconds + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;clear and disable alarm + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT-;turn off alarm control output port + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_lsb + OPERAND2-00 + COMMENT-;clear 'us' interrupt counter + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_msb + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT-;enable the 1us interrupts + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Start of the main program loop. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A prompt is transmitted to the UART transmitter and then + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a command can be entered and interpreted. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-prompt_input +INSTRUCTION-CALL + OPERAND1-send_prompt + OPERAND2- + COMMENT-;Prompt 'KCPSM3>' + LABEL- +INSTRUCTION-CALL + OPERAND1-receive_string + OPERAND2- + COMMENT-;obtain input string and maintain the time + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Parse the string and perform actions as required + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return does nothing + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-prompt_input + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_T + COMMENT-;start of 'TIME' command? + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_for_TIME + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_A + COMMENT-;start of 'ALARM' command? + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_for_ALARM + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;trap other command starts here + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-bad_input_command +INSTRUCTION-CALL + OPERAND1-send_Syntax_Error + OPERAND2- + COMMENT-;no valid command + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-prompt_input + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-test_for_TIME +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_I + COMMENT-;test for rest of 'TIME' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_M + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_E + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;now have a valid TIME command to process + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return means display time + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-set_time_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OPERAND2- + COMMENT-;transmit time to UART + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-set_time_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_space + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OPERAND2- + COMMENT-;interpret 'hh:mm:ss' string + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-prompt_input + COMMENT-;test for invalid input + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OPERAND2-real_time_hours + COMMENT-;set new time into clock + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-real_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-real_time_seconds + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_lsb + COMMENT-;clear 'ms' counter (s0=00) + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OPERAND2- + COMMENT-;transmit new time to UART + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-test_for_ALARM +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_L + COMMENT-;test for rest of 'ALARM' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_A + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_R + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_M + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;now have a valid ALARM command to process + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return means display alarm time + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-set_alarm_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit time to UART + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-set_alarm_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_space + COMMENT-;test for ON or OFF command + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-set_alarm_on_off + COMMENT- + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;move memory pointer back to first character of 'hh:mm:ss' string + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OPERAND2- + COMMENT-;interpret 'hh:mm:ss' string + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-prompt_input + COMMENT-;test for invalid input + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OPERAND2-alarm_time_hours + COMMENT-;set new time into clock + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-alarm_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-alarm_time_seconds + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit new alarm time and status + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-set_alarm_on_off +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_N + COMMENT-;test for 'ON' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-test_OFF + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;turn alarm on + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit alarm time and status + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-test_OFF +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_F + COMMENT-;test for for 'OFF' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_F + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;turn alarm off and stop an active alarm + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT-;turn off alarm + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit alarm time and status + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Read an 'hh:mm:ss' time string and provide new values. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string must be provided in successive scratch pad memory locations + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with the s1 register containing the location of the first character. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A correct time specification will result in the return of new values + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;as follows:- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s6 = hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s5 = minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s4 = seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the syntax is incorrect or values are not in the correct ranges an + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;'Invalid Time' message will be transmitted and the CARRY flag will be set + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s6, s5 and s4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-test_time_string +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain hours value + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + LABEL- +INSTRUCTION-LOAD + OPERAND1-s6 + OPERAND2-s2 + COMMENT-;remember hours + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past hours + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;test for colon + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain minutes value + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + LABEL- +INSTRUCTION-LOAD + OPERAND1-s5 + OPERAND2-s2 + COMMENT-;remember minutes + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past minutes + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;test for colon + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain seconds value + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + LABEL- +INSTRUCTION-LOAD + OPERAND1-s4 + OPERAND2-s2 + COMMENT-;remember minutes + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past seconds + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;finish with carriage return + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Have values for hh:mm:ss but need to test if each is valid range. + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s6 + OPERAND2-hours_in_a_day + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s5 + OPERAND2-minutes_in_an_hour + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s4 + OPERAND2-seconds_in_a_minute + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OPERAND2- + COMMENT-;reset CARRY flag (with s0=0) + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;time string was OK + LABEL-invalid_time +INSTRUCTION-CALL + OPERAND1-send_Invalid + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Time + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OPERAND2- + COMMENT-;set CARRY flag + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;time string was bad + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Fetch character from memory, convert to upper case + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;and increment memory pointer. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The memory pointer is provided in register s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character obtained is returned in register s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-fetch_char_from_memory +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT-;read character + LABEL- +INSTRUCTION-CALL + OPERAND1-upper_case + OPERAND2- + COMMENT-;convert to upper case + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Read one character from the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Character read will be returned in a register called 'UART_data' and will be + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;echoed to the UART transmitter. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first tests the receiver FIFO buffer to see if data is present. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the FIFO is empty, the routine waits until there is a character to read. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;As this could take any amount of time the wait loop includes a call to the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;subroutine which updates the real time clock. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and UART_data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-read_from_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_data_present + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-read_character + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OPERAND2- + COMMENT-;Perform useful operation whilst waiting + LABEL- +INSTRUCTION-JUMP + OPERAND1-read_from_UART + OPERAND2- + COMMENT- + LABEL-read_character +INSTRUCTION-INPUT + OPERAND1-UART_data + OPERAND2-UART_read_port + COMMENT-;read from FIFO + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT-;echo received character + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit one character to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Character supplied in register called 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first tests the transmit FIFO buffer to see if it is full. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the FIFO is full, the routine waits until there is space which could + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;be as long as it takes to transmit one complete character. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Baud Rate Time per Character (10 bits) + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 9600 1,024us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 19200 521us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 38400 260us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 57600 174us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 115200 87us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Since this is a relatively long duration, the wait loop includes a + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;call to the subroutine which updates the real time clock. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_to_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Tx_FIFO buffer + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-tx_full + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-UART_write + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OPERAND2- + COMMENT-;Perform useful operation whilst waiting + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL-UART_write +INSTRUCTION-OUTPUT + OPERAND1-UART_data + OPERAND2-UART_write_port + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Alarm output + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Uses the alarm status scratch pad memory to set or reset the alarm + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;control bit on the alarm output port. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-alarm_drive +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;read status + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;isolate bit0 + LABEL- +INSTRUCTION-OUTPUT + OPERAND1-s0 + OPERAND2-alarm_port + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit the time to the UART port in the format hh:mm:ss and end + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with a carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will then be transmitted. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-transmit_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OPERAND2-real_time_hours + COMMENT-;locate current time in memory + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;ending with carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The alarm time to converted must be stored in 3 scratch pad memory locations as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will then be transmitted. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-transmit_alarm_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OPERAND2-alarm_time_hours + COMMENT-;locate alarm time in memory + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Alarm + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;read alarm status + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;test for active + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_armed + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Active + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL-test_armed +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT-;test for on + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-alarm_is_off + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_ON + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL-alarm_is_off +INSTRUCTION-CALL + OPERAND1-send_OFF + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit ASCII string to UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;An ASCII string must be provided in scratch pad memory commencing at the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;location specified by a constant named 'string_start'. The string must + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;end with a carriage return (0D). + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s1 and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s0 is then used in subroutine 'send_to_UART' + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-transmit_string +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;locate start of string + LABEL-next_char_tx +INSTRUCTION-FETCH + OPERAND1-UART_data + OPERAND2-(s1) + COMMENT-;read character from memory + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT-;transmit character + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT-;test for last character + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;move to next character + LABEL- +INSTRUCTION-JUMP + OPERAND1-next_char_tx + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Receive ASCII string from UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;An ASCII string will be read from the UART and stored in scratch pad memory + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;commencing at the location specified by a constant named 'string_start'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will will have a maximum length of 16 characters including a + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;carriage return (0D) denoting the end of the string. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;As each character is read, it is echoed to the UART transmitter. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Some minor editing is supported using backspace (BS=08) which is used + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;to adjust what is stored in scratch pad memory and adjust the display + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;on the terminal screen using characters sent to the UART transmitter. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A test is made for the receiver FIFO becoming full. A full status is treated as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a potential error situation and will result in a 'Overflow Error' message being + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;transmitted to the UART, the receiver FIFO being purged of all data and an + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;empty string being stored (carriage return at first location). + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2 and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-receive_string +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;locate start of string + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-s1 + COMMENT-;compute 16 character address + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-10 + COMMENT- + LABEL-receive_full_test +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer for full + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_full + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-read_error + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-read_from_UART + OPERAND2- + COMMENT-;obtain and echo character + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OPERAND2-(s1) + COMMENT-;write to memory + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT-;test for end of string + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_BS + COMMENT-;test for back space + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-BS_edit + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-s2 + COMMENT-;test for pointer exceeding 16 characters + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-receive_full_test + COMMENT-;next character + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OPERAND2- + COMMENT-;hold end of string position on terminal display + LABEL-BS_edit +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;memory pointer back one + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;test for under flow + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-string_start_again + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT-;clear character at current position + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OPERAND2- + COMMENT-;position cursor + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_full_test + OPERAND2- + COMMENT-;next character + LABEL-string_start_again +INSTRUCTION-CALL + OPERAND1-send_greater_than + OPERAND2- + COMMENT-;restore '>' at prompt + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_string + OPERAND2- + COMMENT-;begin again + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Receiver buffer overflow condition + LABEL-read_error +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT-;Transmit error message + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OPERAND2-string_start + COMMENT-;empty string in memory (start with CR) + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Overflow_Error + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT- + LABEL-clear_UART_Rx_loop +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer for data + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_data_present + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT-;finish when buffer is empty + LABEL- +INSTRUCTION-INPUT + OPERAND1-UART_data + OPERAND2-UART_read_port + COMMENT-;read from FIFO and ignore + LABEL- +INSTRUCTION-JUMP + OPERAND1-clear_UART_Rx_loop + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send Carriage Return to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_CR +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send a space to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_space +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_space + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send a back space to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_backspace +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_BS + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Syntax Error' to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Syntax_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_S + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_y + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_n + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_t + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_x + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_space_Error + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Overflow Error' to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Overflow_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_f + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_o + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_w + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL-send_space_Error +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Error' to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_E + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_o + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'KCPSM3>' prompt to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_prompt +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT-;start new line + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_K + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_C + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_P + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_S + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_M + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_3 + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send '>' character to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_greater_than +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_greater_than + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Invalid' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Invalid +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_I + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_n + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_d + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Time' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Time +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_T + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_m + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Alarm' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Alarm +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_A + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_m + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'OFF' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_OFF +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_F + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'ON' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_ON +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_N + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Active' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Active +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_A + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_c + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_t + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert time to ASCII string in scratch pad memory. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The resulting ASCII string will be stored in scratch pad memory starting at + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a location specified by a constant named 'string_start'. The string will + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;take the format hh:mm:ss and end with a carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2 and 'store_pointer'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-time_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-string_start + COMMENT-;location for string + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read hours value + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write hours to string + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;write ':' to string + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OPERAND2-01 + COMMENT-;move to minutes + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read minutes value + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write minutes to string + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;write ':' to string + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OPERAND2-01 + COMMENT-;move to seconds + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read seconds value + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write seconds to string + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;finish string with carriage return + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert value provided in register s0 into ASCII characters + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The value provided must in the range 0 to 99 and will be converted into + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;two ASCII characters. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; The number of 'tens' will be representd by an ASCII character returned in register s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; The number of 'units' will be representd by an ASCII character returned in register s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;the actual decimal value. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-decimal_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-30 + COMMENT-;load 'tens' counter with ASCII for '0' + LABEL-test_for_ten +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment 'tens' value + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OPERAND2-0A + COMMENT-;try to subtract 10 from the supplied value + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-test_for_ten + COMMENT-;repeat if subtraction was possible without underflow. + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;'tens' value one less ten due to underflow + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-3A + COMMENT-;restore units value (the remainder) and convert to ASCII + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Real Time Clock + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;micro-seconds have elapsed since the last update. This allows for just over 65ms between + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;is used to update the real time hours, minutes and seconds clock held in scratch pad + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;memory during the routine and restored before returning. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Useful constants for real time clock operations + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_lsb + OPERAND2-E8 + COMMENT-;lower 8-bits of 1000 count value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_msb + OPERAND2-03 + COMMENT-;upper 8-bits of 1000 count value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-hours_in_a_day + OPERAND2-18 + COMMENT-;24 hours in a day + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-minutes_in_an_hour + OPERAND2-3C + COMMENT-;60 minutes in an hour + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-seconds_in_a_minute + OPERAND2-3C + COMMENT-;60 seconds in a minute + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-update_time +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-time_preserve0 + COMMENT-;preserve contents of registers used during routine + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-time_preserve1 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-time_preserve2 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-time_preserve3 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-time_preserve4 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-time_preserve5 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-us_time_stamp_lsb + COMMENT-;read the previous 'us' time stamp into [s3,s2] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-us_time_stamp_msb + COMMENT- + LABEL- +INSTRUCTION-DISABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT-;Read and store current 'us' time stamp provided by the interrupt + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_lsb + OPERAND2-us_time_stamp_lsb + COMMENT-;counter. Interrupts are disabled to ensure that both bytes relate + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_msb + OPERAND2-us_time_stamp_msb + COMMENT-;to the same count value. + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OPERAND2-us_time_stamp_lsb + COMMENT-;read the new 'us' time stamp in [s5,s4] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OPERAND2-us_time_stamp_msb + COMMENT-; + LABEL- +INSTRUCTION-SUB + OPERAND1-s4 + OPERAND2-s2 + COMMENT-;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s5 + OPERAND2-s3 + COMMENT-; (This works correctly even if counter has rolled over) + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-us_time_lsb + COMMENT-;read current 'us' time into [s3,s2] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-us_time_msb + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s4 + COMMENT-;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-s5 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;determine how many 1000us (1ms) units there are (if any) in current 'us' time + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;reset 'ms' counter + LABEL-test_1000us +INSTRUCTION-SUB + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;subtract 1000 from [s3,s2] + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-store_us_time + COMMENT-;Carry indicates [s3,s2] was less than 1000us + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-01 + COMMENT-;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + LABEL- +INSTRUCTION-JUMP + OPERAND1-test_1000us + OPERAND2- + COMMENT-;repeat to see if more than 1ms has elapsed + LABEL-store_us_time +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;add 1000 to restore 'us' value + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-us_time_lsb + COMMENT-;store the current value of 'us' + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-us_time_msb + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;s0 holds the number of 'ms' elapsed since last update (if any). + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-ms_time_lsb + COMMENT-;read current 'ms' time into [s3,s2] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT-;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;determine if there are now more than 1000ms to form 1 second. + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;reset 'second' counter + LABEL- +INSTRUCTION-SUB + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;subtract 1000 from [s3,s2] + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-restore_ms_time + COMMENT-;Carry indicates [s3,s2] was less than 1000ms + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-01 + COMMENT-;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + LABEL- +INSTRUCTION-JUMP + OPERAND1-store_ms_time + OPERAND2- + COMMENT-;new value of 'ms' is remainder of subtraction + LABEL-restore_ms_time +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;add 1000 to restore 'ms' value + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL-store_ms_time +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-ms_time_lsb + COMMENT-;store the current value of 'ms' + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT-;read seconds + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-s0 + COMMENT-;add one second if required by s0 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-seconds_in_a_minute + COMMENT-;test for 1 minute + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-inc_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT-;store updated seconds + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + LABEL-inc_minutes +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;seconds become zero + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT-;read minutes + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment minutes + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-minutes_in_an_hour + COMMENT-;test for 1 hour + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-inc_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT-;store updated minutes + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + LABEL-inc_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;minutes become zero + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT-;read hours + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment hours + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-hours_in_a_day + COMMENT-;test for 24 hours + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-reset_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT-;store updated hours + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + LABEL-reset_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;hours become zero + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;With the time updated, there is then a test for time=alarm time + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-time_update_complete +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_hours + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_hours + COMMENT-;compare hours + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_minutes + COMMENT-;compare minutes + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_minutes + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_seconds + COMMENT-;compare seconds + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_seconds + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;test if alarm is turned on + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-finish_update + COMMENT-;alarm was off + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;activate alarm + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT- + LABEL-finish_update +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-time_preserve0 + COMMENT-;restore the register contents + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-time_preserve1 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-time_preserve2 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-time_preserve3 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OPERAND2-time_preserve4 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OPERAND2-time_preserve5 + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert character to upper case + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character supplied in register s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the character is in the range 'a' to 'z', it is converted + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;to the equivalent upper case character in the range 'A' to 'Z'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;All other characters remain unchanged. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-upper_case +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-61 + COMMENT-;eliminate character codes below 'a' (61 hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-7B + COMMENT-;eliminate character codes above 'z' (7A hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1-NC + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OPERAND2-DF + COMMENT-;mask bit5 to convert to upper case + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert character '0' to '9' to numerical value in range 0 to 9 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character supplied in register s0. If the character is in the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;range '0' to '9', it is converted to the equivalent decimal value. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Characters not in the range '0' to '9' are signified by the return + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with the CARRY flag set. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-1char_to_value +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-C6 + COMMENT-;reject character codes above '9' (39 hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;carry flag is set + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OPERAND2-F6 + COMMENT-;reject character codes below '0' (30 hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;carry is set if value not in range + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Determine the numerical value of a two character decimal string held in + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string must be stored as in two consecutive memory locations and the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;location of the first (tens) character supplied in the s1 register. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The result is provided in register s2. Strings not using characters in the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;range '0' to '9' are signified by the return with the CARRY flag set. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1 and s2. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-2char_to_value +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT-;read 'tens' character + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OPERAND2- + COMMENT-;convert to numerical value + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;bad character - CARRY set + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-s0 + COMMENT- + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT-;multiply 'tens' value by 10 (0A hex) + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT- + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;read 'units' character + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OPERAND2- + COMMENT-;convert to numerical value + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;bad character - CARRY set + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT-;add units to result and clear CARRY flag + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Interrupt service routine (ISR) + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The interrupt is used to increment a 16-bit counter formed with two registers + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;of micro-seconds elapsed. The counter is 'free running' in that it will count + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;up to 65,535 and then roll over to zero. The count value is then used in other + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;parts of the program as required and where it is less time critical. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The ISR only uses the specified counter registers + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FC + OPERAND2- + COMMENT- + LABEL-ISR +INSTRUCTION-ADD + OPERAND1-int_counter_lsb + OPERAND2-01 + COMMENT-;add 1us to 16-bit counter + LABEL- +INSTRUCTION-ADDCY + OPERAND1-int_counter_msb + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION-RETURNI + OPERAND1-ENABLE + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Interrupt vector + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FF + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-ISR + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Useful constants + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;ASCII table + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_a + OPERAND2-61 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_b + OPERAND2-62 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_c + OPERAND2-63 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_d + OPERAND2-64 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_e + OPERAND2-65 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_f + OPERAND2-66 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_g + OPERAND2-67 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_h + OPERAND2-68 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_i + OPERAND2-69 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_j + OPERAND2-6A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_k + OPERAND2-6B + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_l + OPERAND2-6C + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_m + OPERAND2-6D + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_n + OPERAND2-6E + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_o + OPERAND2-6F + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_p + OPERAND2-70 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_q + OPERAND2-71 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_r + OPERAND2-72 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_s + OPERAND2-73 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_t + OPERAND2-74 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_u + OPERAND2-75 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_v + OPERAND2-76 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_w + OPERAND2-77 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_x + OPERAND2-78 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_y + OPERAND2-79 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_z + OPERAND2-7A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_A + OPERAND2-41 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_B + OPERAND2-42 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_C + OPERAND2-43 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_D + OPERAND2-44 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_E + OPERAND2-45 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_F + OPERAND2-46 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_G + OPERAND2-47 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_H + OPERAND2-48 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_I + OPERAND2-49 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_J + OPERAND2-4A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_K + OPERAND2-4B + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_L + OPERAND2-4C + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_M + OPERAND2-4D + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_N + OPERAND2-4E + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_O + OPERAND2-4F + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_P + OPERAND2-50 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Q + OPERAND2-51 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_R + OPERAND2-52 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_S + OPERAND2-53 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_T + OPERAND2-54 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_U + OPERAND2-55 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_V + OPERAND2-56 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_W + OPERAND2-57 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_X + OPERAND2-58 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Y + OPERAND2-59 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Z + OPERAND2-5A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_0 + OPERAND2-30 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_1 + OPERAND2-31 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_2 + OPERAND2-32 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_3 + OPERAND2-33 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_4 + OPERAND2-34 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_5 + OPERAND2-35 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_6 + OPERAND2-36 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_7 + OPERAND2-37 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_8 + OPERAND2-38 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_9 + OPERAND2-39 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_colon + OPERAND2-3A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_semi_colon + OPERAND2-3B + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_less_than + OPERAND2-3C + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_greater_than + OPERAND2-3E + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_equals + OPERAND2-3D + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_space + OPERAND2-20 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_CR + OPERAND2-0D + COMMENT-;carriage return + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_question + OPERAND2-3F + COMMENT-;'?' + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_dollar + OPERAND2-24 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_BS + OPERAND2-08 + COMMENT-;Back Space command character + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; diff --git a/projects/PicoBlaze/ise/Assembler/PASS2.DAT b/projects/PicoBlaze/ise/Assembler/PASS2.DAT new file mode 100644 index 0000000..e5fc484 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/PASS2.DAT @@ -0,0 +1,5040 @@ + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;KCPSM3 Program - Real Time Clock with UART communication. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Ken Chapman - Xilinx Ltd - October 2003 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Port definitions + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_status_port + OPERAND2-00 + COMMENT-;UART status input + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_half_full + OPERAND2-01 + COMMENT-; Transmitter half full - bit0 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_full + OPERAND2-02 + COMMENT-; FIFO full - bit1 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_half_full + OPERAND2-04 + COMMENT-; Receiver half full - bit2 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_full + OPERAND2-08 + COMMENT-; FIFO full - bit3 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_data_present + OPERAND2-10 + COMMENT-; data present - bit4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_read_port + OPERAND2-01 + COMMENT-;UART Rx data input + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_write_port + OPERAND2-01 + COMMENT-;UART Tx data output + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_port + OPERAND2-00 + COMMENT-;Alarm output + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_control + OPERAND2-01 + COMMENT-; bit0 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Special Register usage + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sF + OPERAND2-UART_data + COMMENT-;used to pass data to and from the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sE + OPERAND2-store_pointer + COMMENT-;used to pass location of data in scratch pad memory + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Two registers to form a 16-bit counter used to count + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;interrupt pulses generated at 1us intervals. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sD + OPERAND2-int_counter_lsb + COMMENT-;lower 8-bits + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sC + OPERAND2-int_counter_msb + COMMENT-;upper 8-bits + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Scratch Pad Memory Locations + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_lsb + OPERAND2-00 + COMMENT-;16-bit micro-second time stamp + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_msb + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_lsb + OPERAND2-02 + COMMENT-;16-bit micro-second real time value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_msb + OPERAND2-03 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_lsb + OPERAND2-04 + COMMENT-;16-bit milli-second real time value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_msb + OPERAND2-05 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_hours + OPERAND2-06 + COMMENT-;Current clock time + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_minutes + OPERAND2-07 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_seconds + OPERAND2-08 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_hours + OPERAND2-09 + COMMENT-;Alarm time + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_minutes + OPERAND2-0A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_seconds + OPERAND2-0B + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_status + OPERAND2-0C + COMMENT-;Alarm status + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_active + OPERAND2-01 + COMMENT-; bit0 - Alarm is active + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_armed + OPERAND2-02 + COMMENT-; bit1 - Alarm is armed + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve0 + OPERAND2-10 + COMMENT-;storage for protection of registers + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve1 + OPERAND2-11 + COMMENT-;used by the real time clock routine. + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve2 + OPERAND2-12 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve3 + OPERAND2-13 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve4 + OPERAND2-14 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve5 + OPERAND2-15 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;UART character strings will be stored in scratch pad memory ending in carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A string can be up to 16 characters with the start location defined by this constant. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-string_start + OPERAND2-20 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Initialise the system + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-cold_start +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;clear all time values + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_stamp_lsb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_stamp_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_lsb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_lsb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_seconds + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_seconds + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;clear and disable alarm + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT-;turn off alarm control output port + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_lsb + OPERAND2-00 + COMMENT-;clear 'us' interrupt counter + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_msb + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT-;enable the 1us interrupts + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Start of the main program loop. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A prompt is transmitted to the UART transmitter and then + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a command can be entered and interpreted. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-prompt_input +INSTRUCTION-CALL + OPERAND1-send_prompt + OPERAND2- + COMMENT-;Prompt 'KCPSM3>' + LABEL- +INSTRUCTION-CALL + OPERAND1-receive_string + OPERAND2- + COMMENT-;obtain input string and maintain the time + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Parse the string and perform actions as required + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return does nothing + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-prompt_input + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_T + COMMENT-;start of 'TIME' command? + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_for_TIME + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_A + COMMENT-;start of 'ALARM' command? + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_for_ALARM + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;trap other command starts here + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-bad_input_command +INSTRUCTION-CALL + OPERAND1-send_Syntax_Error + OPERAND2- + COMMENT-;no valid command + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-prompt_input + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-test_for_TIME +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_I + COMMENT-;test for rest of 'TIME' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_M + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_E + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;now have a valid TIME command to process + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return means display time + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-set_time_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OPERAND2- + COMMENT-;transmit time to UART + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-set_time_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_space + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OPERAND2- + COMMENT-;interpret 'hh:mm:ss' string + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-prompt_input + COMMENT-;test for invalid input + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OPERAND2-real_time_hours + COMMENT-;set new time into clock + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-real_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-real_time_seconds + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_lsb + COMMENT-;clear 'ms' counter (s0=00) + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OPERAND2- + COMMENT-;transmit new time to UART + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-test_for_ALARM +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_L + COMMENT-;test for rest of 'ALARM' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_A + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_R + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_M + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;now have a valid ALARM command to process + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return means display alarm time + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-set_alarm_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit time to UART + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-set_alarm_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_space + COMMENT-;test for ON or OFF command + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-set_alarm_on_off + COMMENT- + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;move memory pointer back to first character of 'hh:mm:ss' string + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OPERAND2- + COMMENT-;interpret 'hh:mm:ss' string + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-prompt_input + COMMENT-;test for invalid input + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OPERAND2-alarm_time_hours + COMMENT-;set new time into clock + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-alarm_time_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-alarm_time_seconds + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit new alarm time and status + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-set_alarm_on_off +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_N + COMMENT-;test for 'ON' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-test_OFF + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;turn alarm on + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit alarm time and status + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL-test_OFF +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_F + COMMENT-;test for for 'OFF' + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_F + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;turn alarm off and stop an active alarm + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT-;turn off alarm + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit alarm time and status + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Read an 'hh:mm:ss' time string and provide new values. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string must be provided in successive scratch pad memory locations + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with the s1 register containing the location of the first character. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A correct time specification will result in the return of new values + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;as follows:- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s6 = hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s5 = minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s4 = seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the syntax is incorrect or values are not in the correct ranges an + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;'Invalid Time' message will be transmitted and the CARRY flag will be set + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s6, s5 and s4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-test_time_string +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain hours value + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + LABEL- +INSTRUCTION-LOAD + OPERAND1-s6 + OPERAND2-s2 + COMMENT-;remember hours + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past hours + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;test for colon + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain minutes value + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + LABEL- +INSTRUCTION-LOAD + OPERAND1-s5 + OPERAND2-s2 + COMMENT-;remember minutes + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past minutes + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;test for colon + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain seconds value + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + LABEL- +INSTRUCTION-LOAD + OPERAND1-s4 + OPERAND2-s2 + COMMENT-;remember minutes + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past seconds + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;finish with carriage return + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Have values for hh:mm:ss but need to test if each is valid range. + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s6 + OPERAND2-hours_in_a_day + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s5 + OPERAND2-minutes_in_an_hour + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s4 + OPERAND2-seconds_in_a_minute + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OPERAND2- + COMMENT-;reset CARRY flag (with s0=0) + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;time string was OK + LABEL-invalid_time +INSTRUCTION-CALL + OPERAND1-send_Invalid + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Time + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OPERAND2- + COMMENT-;set CARRY flag + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;time string was bad + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Fetch character from memory, convert to upper case + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;and increment memory pointer. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The memory pointer is provided in register s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character obtained is returned in register s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-fetch_char_from_memory +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT-;read character + LABEL- +INSTRUCTION-CALL + OPERAND1-upper_case + OPERAND2- + COMMENT-;convert to upper case + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Read one character from the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Character read will be returned in a register called 'UART_data' and will be + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;echoed to the UART transmitter. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first tests the receiver FIFO buffer to see if data is present. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the FIFO is empty, the routine waits until there is a character to read. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;As this could take any amount of time the wait loop includes a call to the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;subroutine which updates the real time clock. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and UART_data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-read_from_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_data_present + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-read_character + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OPERAND2- + COMMENT-;Perform useful operation whilst waiting + LABEL- +INSTRUCTION-JUMP + OPERAND1-read_from_UART + OPERAND2- + COMMENT- + LABEL-read_character +INSTRUCTION-INPUT + OPERAND1-UART_data + OPERAND2-UART_read_port + COMMENT-;read from FIFO + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT-;echo received character + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit one character to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Character supplied in register called 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first tests the transmit FIFO buffer to see if it is full. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the FIFO is full, the routine waits until there is space which could + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;be as long as it takes to transmit one complete character. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Baud Rate Time per Character (10 bits) + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 9600 1,024us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 19200 521us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 38400 260us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 57600 174us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 115200 87us + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Since this is a relatively long duration, the wait loop includes a + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;call to the subroutine which updates the real time clock. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_to_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Tx_FIFO buffer + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-tx_full + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-UART_write + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OPERAND2- + COMMENT-;Perform useful operation whilst waiting + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL-UART_write +INSTRUCTION-OUTPUT + OPERAND1-UART_data + OPERAND2-UART_write_port + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Alarm output + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Uses the alarm status scratch pad memory to set or reset the alarm + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;control bit on the alarm output port. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-alarm_drive +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;read status + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;isolate bit0 + LABEL- +INSTRUCTION-OUTPUT + OPERAND1-s0 + OPERAND2-alarm_port + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit the time to the UART port in the format hh:mm:ss and end + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with a carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will then be transmitted. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-transmit_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OPERAND2-real_time_hours + COMMENT-;locate current time in memory + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;ending with carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The alarm time to converted must be stored in 3 scratch pad memory locations as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will then be transmitted. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-transmit_alarm_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OPERAND2-alarm_time_hours + COMMENT-;locate alarm time in memory + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Alarm + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;read alarm status + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;test for active + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_armed + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Active + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL-test_armed +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT-;test for on + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-alarm_is_off + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_ON + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL-alarm_is_off +INSTRUCTION-CALL + OPERAND1-send_OFF + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit ASCII string to UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;An ASCII string must be provided in scratch pad memory commencing at the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;location specified by a constant named 'string_start'. The string must + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;end with a carriage return (0D). + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s1 and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s0 is then used in subroutine 'send_to_UART' + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-transmit_string +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;locate start of string + LABEL-next_char_tx +INSTRUCTION-FETCH + OPERAND1-UART_data + OPERAND2-(s1) + COMMENT-;read character from memory + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT-;transmit character + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT-;test for last character + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;move to next character + LABEL- +INSTRUCTION-JUMP + OPERAND1-next_char_tx + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Receive ASCII string from UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;An ASCII string will be read from the UART and stored in scratch pad memory + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;commencing at the location specified by a constant named 'string_start'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will will have a maximum length of 16 characters including a + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;carriage return (0D) denoting the end of the string. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;As each character is read, it is echoed to the UART transmitter. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Some minor editing is supported using backspace (BS=08) which is used + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;to adjust what is stored in scratch pad memory and adjust the display + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;on the terminal screen using characters sent to the UART transmitter. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A test is made for the receiver FIFO becoming full. A full status is treated as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a potential error situation and will result in a 'Overflow Error' message being + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;transmitted to the UART, the receiver FIFO being purged of all data and an + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;empty string being stored (carriage return at first location). + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2 and 'UART_data'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-receive_string +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;locate start of string + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-s1 + COMMENT-;compute 16 character address + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-10 + COMMENT- + LABEL-receive_full_test +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer for full + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_full + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-read_error + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-read_from_UART + OPERAND2- + COMMENT-;obtain and echo character + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OPERAND2-(s1) + COMMENT-;write to memory + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT-;test for end of string + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_BS + COMMENT-;test for back space + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-BS_edit + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-s2 + COMMENT-;test for pointer exceeding 16 characters + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-receive_full_test + COMMENT-;next character + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OPERAND2- + COMMENT-;hold end of string position on terminal display + LABEL-BS_edit +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;memory pointer back one + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;test for under flow + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-string_start_again + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT-;clear character at current position + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OPERAND2- + COMMENT-;position cursor + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_full_test + OPERAND2- + COMMENT-;next character + LABEL-string_start_again +INSTRUCTION-CALL + OPERAND1-send_greater_than + OPERAND2- + COMMENT-;restore '>' at prompt + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_string + OPERAND2- + COMMENT-;begin again + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Receiver buffer overflow condition + LABEL-read_error +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT-;Transmit error message + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OPERAND2-string_start + COMMENT-;empty string in memory (start with CR) + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Overflow_Error + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT- + LABEL-clear_UART_Rx_loop +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer for data + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_data_present + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT-;finish when buffer is empty + LABEL- +INSTRUCTION-INPUT + OPERAND1-UART_data + OPERAND2-UART_read_port + COMMENT-;read from FIFO and ignore + LABEL- +INSTRUCTION-JUMP + OPERAND1-clear_UART_Rx_loop + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send Carriage Return to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_CR +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send a space to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_space +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_space + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send a back space to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_backspace +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_BS + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Syntax Error' to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Syntax_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_S + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_y + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_n + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_t + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_x + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_space_Error + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Overflow Error' to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Overflow_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_f + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_o + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_w + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL-send_space_Error +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Error' to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_E + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_o + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'KCPSM3>' prompt to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_prompt +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT-;start new line + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_K + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_C + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_P + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_S + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_M + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_3 + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send '>' character to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_greater_than +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_greater_than + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Invalid' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Invalid +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_I + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_n + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_d + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Time' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Time +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_T + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_m + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Alarm' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Alarm +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_A + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_m + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'OFF' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_OFF +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_F + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'ON' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_ON +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_N + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Active' string to the UART + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-send_Active +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_A + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_c + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_t + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert time to ASCII string in scratch pad memory. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The resulting ASCII string will be stored in scratch pad memory starting at + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a location specified by a constant named 'string_start'. The string will + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;take the format hh:mm:ss and end with a carriage return. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2 and 'store_pointer'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-time_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-string_start + COMMENT-;location for string + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read hours value + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write hours to string + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;write ':' to string + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OPERAND2-01 + COMMENT-;move to minutes + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read minutes value + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write minutes to string + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;write ':' to string + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OPERAND2-01 + COMMENT-;move to seconds + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read seconds value + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write seconds to string + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;finish string with carriage return + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert value provided in register s0 into ASCII characters + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The value provided must in the range 0 to 99 and will be converted into + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;two ASCII characters. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; The number of 'tens' will be representd by an ASCII character returned in register s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; The number of 'units' will be representd by an ASCII character returned in register s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;the actual decimal value. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and s1. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-decimal_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-30 + COMMENT-;load 'tens' counter with ASCII for '0' + LABEL-test_for_ten +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment 'tens' value + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OPERAND2-0A + COMMENT-;try to subtract 10 from the supplied value + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-test_for_ten + COMMENT-;repeat if subtraction was possible without underflow. + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;'tens' value one less ten due to underflow + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-3A + COMMENT-;restore units value (the remainder) and convert to ASCII + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Real Time Clock + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;micro-seconds have elapsed since the last update. This allows for just over 65ms between + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;is used to update the real time hours, minutes and seconds clock held in scratch pad + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;memory during the routine and restored before returning. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Useful constants for real time clock operations + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_lsb + OPERAND2-E8 + COMMENT-;lower 8-bits of 1000 count value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_msb + OPERAND2-03 + COMMENT-;upper 8-bits of 1000 count value + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-hours_in_a_day + OPERAND2-18 + COMMENT-;24 hours in a day + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-minutes_in_an_hour + OPERAND2-3C + COMMENT-;60 minutes in an hour + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-seconds_in_a_minute + OPERAND2-3C + COMMENT-;60 seconds in a minute + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-update_time +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-time_preserve0 + COMMENT-;preserve contents of registers used during routine + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-time_preserve1 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-time_preserve2 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-time_preserve3 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-time_preserve4 + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-time_preserve5 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-us_time_stamp_lsb + COMMENT-;read the previous 'us' time stamp into [s3,s2] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-us_time_stamp_msb + COMMENT- + LABEL- +INSTRUCTION-DISABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT-;Read and store current 'us' time stamp provided by the interrupt + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_lsb + OPERAND2-us_time_stamp_lsb + COMMENT-;counter. Interrupts are disabled to ensure that both bytes relate + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_msb + OPERAND2-us_time_stamp_msb + COMMENT-;to the same count value. + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OPERAND2-us_time_stamp_lsb + COMMENT-;read the new 'us' time stamp in [s5,s4] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OPERAND2-us_time_stamp_msb + COMMENT-; + LABEL- +INSTRUCTION-SUB + OPERAND1-s4 + OPERAND2-s2 + COMMENT-;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s5 + OPERAND2-s3 + COMMENT-; (This works correctly even if counter has rolled over) + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-us_time_lsb + COMMENT-;read current 'us' time into [s3,s2] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-us_time_msb + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s4 + COMMENT-;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-s5 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;determine how many 1000us (1ms) units there are (if any) in current 'us' time + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;reset 'ms' counter + LABEL-test_1000us +INSTRUCTION-SUB + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;subtract 1000 from [s3,s2] + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-store_us_time + COMMENT-;Carry indicates [s3,s2] was less than 1000us + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-01 + COMMENT-;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + LABEL- +INSTRUCTION-JUMP + OPERAND1-test_1000us + OPERAND2- + COMMENT-;repeat to see if more than 1ms has elapsed + LABEL-store_us_time +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;add 1000 to restore 'us' value + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-us_time_lsb + COMMENT-;store the current value of 'us' + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-us_time_msb + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;s0 holds the number of 'ms' elapsed since last update (if any). + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-ms_time_lsb + COMMENT-;read current 'ms' time into [s3,s2] + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT-;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;determine if there are now more than 1000ms to form 1 second. + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;reset 'second' counter + LABEL- +INSTRUCTION-SUB + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;subtract 1000 from [s3,s2] + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-restore_ms_time + COMMENT-;Carry indicates [s3,s2] was less than 1000ms + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-01 + COMMENT-;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + LABEL- +INSTRUCTION-JUMP + OPERAND1-store_ms_time + OPERAND2- + COMMENT-;new value of 'ms' is remainder of subtraction + LABEL-restore_ms_time +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;add 1000 to restore 'ms' value + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + LABEL-store_ms_time +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-ms_time_lsb + COMMENT-;store the current value of 'ms' + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-ms_time_msb + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT-;read seconds + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-s0 + COMMENT-;add one second if required by s0 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-seconds_in_a_minute + COMMENT-;test for 1 minute + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-inc_minutes + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT-;store updated seconds + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + LABEL-inc_minutes +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;seconds become zero + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT-;read minutes + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment minutes + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-minutes_in_an_hour + COMMENT-;test for 1 hour + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-inc_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT-;store updated minutes + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + LABEL-inc_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;minutes become zero + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT-;read hours + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment hours + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-hours_in_a_day + COMMENT-;test for 24 hours + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-reset_hours + COMMENT- + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT-;store updated hours + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + LABEL-reset_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;hours become zero + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;With the time updated, there is then a test for time=alarm time + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-time_update_complete +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_hours + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_hours + COMMENT-;compare hours + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_minutes + COMMENT-;compare minutes + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_minutes + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_seconds + COMMENT-;compare seconds + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_seconds + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;test if alarm is turned on + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-finish_update + COMMENT-;alarm was off + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;activate alarm + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT- + LABEL-finish_update +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-time_preserve0 + COMMENT-;restore the register contents + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-time_preserve1 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-time_preserve2 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-time_preserve3 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OPERAND2-time_preserve4 + COMMENT- + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OPERAND2-time_preserve5 + COMMENT- + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert character to upper case + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character supplied in register s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the character is in the range 'a' to 'z', it is converted + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;to the equivalent upper case character in the range 'A' to 'Z'. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;All other characters remain unchanged. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-upper_case +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-61 + COMMENT-;eliminate character codes below 'a' (61 hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-7B + COMMENT-;eliminate character codes above 'z' (7A hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1-NC + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OPERAND2-DF + COMMENT-;mask bit5 to convert to upper case + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert character '0' to '9' to numerical value in range 0 to 9 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character supplied in register s0. If the character is in the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;range '0' to '9', it is converted to the equivalent decimal value. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Characters not in the range '0' to '9' are signified by the return + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with the CARRY flag set. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-1char_to_value +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-C6 + COMMENT-;reject character codes above '9' (39 hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;carry flag is set + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OPERAND2-F6 + COMMENT-;reject character codes below '0' (30 hex) + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;carry is set if value not in range + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Determine the numerical value of a two character decimal string held in + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string must be stored as in two consecutive memory locations and the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;location of the first (tens) character supplied in the s1 register. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The result is provided in register s2. Strings not using characters in the + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;range '0' to '9' are signified by the return with the CARRY flag set. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1 and s2. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL-2char_to_value +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT-;read 'tens' character + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OPERAND2- + COMMENT-;convert to numerical value + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;bad character - CARRY set + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-s0 + COMMENT- + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT-;multiply 'tens' value by 10 (0A hex) + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT- + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;read 'units' character + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT- + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OPERAND2- + COMMENT-;convert to numerical value + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;bad character - CARRY set + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT-;add units to result and clear CARRY flag + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Interrupt service routine (ISR) + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The interrupt is used to increment a 16-bit counter formed with two registers + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;of micro-seconds elapsed. The counter is 'free running' in that it will count + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;up to 65,535 and then roll over to zero. The count value is then used in other + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;parts of the program as required and where it is less time critical. + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The ISR only uses the specified counter registers + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FC + OPERAND2- + COMMENT- + LABEL-ISR +INSTRUCTION-ADD + OPERAND1-int_counter_lsb + OPERAND2-01 + COMMENT-;add 1us to 16-bit counter + LABEL- +INSTRUCTION-ADDCY + OPERAND1-int_counter_msb + OPERAND2-00 + COMMENT- + LABEL- +INSTRUCTION-RETURNI + OPERAND1-ENABLE + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Interrupt vector + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FF + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION-JUMP + OPERAND1-ISR + OPERAND2- + COMMENT- + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Useful constants + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;ASCII table + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_a + OPERAND2-61 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_b + OPERAND2-62 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_c + OPERAND2-63 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_d + OPERAND2-64 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_e + OPERAND2-65 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_f + OPERAND2-66 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_g + OPERAND2-67 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_h + OPERAND2-68 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_i + OPERAND2-69 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_j + OPERAND2-6A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_k + OPERAND2-6B + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_l + OPERAND2-6C + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_m + OPERAND2-6D + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_n + OPERAND2-6E + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_o + OPERAND2-6F + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_p + OPERAND2-70 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_q + OPERAND2-71 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_r + OPERAND2-72 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_s + OPERAND2-73 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_t + OPERAND2-74 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_u + OPERAND2-75 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_v + OPERAND2-76 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_w + OPERAND2-77 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_x + OPERAND2-78 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_y + OPERAND2-79 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_z + OPERAND2-7A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_A + OPERAND2-41 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_B + OPERAND2-42 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_C + OPERAND2-43 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_D + OPERAND2-44 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_E + OPERAND2-45 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_F + OPERAND2-46 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_G + OPERAND2-47 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_H + OPERAND2-48 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_I + OPERAND2-49 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_J + OPERAND2-4A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_K + OPERAND2-4B + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_L + OPERAND2-4C + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_M + OPERAND2-4D + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_N + OPERAND2-4E + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_O + OPERAND2-4F + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_P + OPERAND2-50 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Q + OPERAND2-51 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_R + OPERAND2-52 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_S + OPERAND2-53 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_T + OPERAND2-54 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_U + OPERAND2-55 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_V + OPERAND2-56 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_W + OPERAND2-57 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_X + OPERAND2-58 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Y + OPERAND2-59 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Z + OPERAND2-5A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_0 + OPERAND2-30 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_1 + OPERAND2-31 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_2 + OPERAND2-32 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_3 + OPERAND2-33 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_4 + OPERAND2-34 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_5 + OPERAND2-35 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_6 + OPERAND2-36 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_7 + OPERAND2-37 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_8 + OPERAND2-38 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_9 + OPERAND2-39 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_colon + OPERAND2-3A + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_semi_colon + OPERAND2-3B + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_less_than + OPERAND2-3C + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_greater_than + OPERAND2-3E + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_equals + OPERAND2-3D + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_space + OPERAND2-20 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_CR + OPERAND2-0D + COMMENT-;carriage return + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_question + OPERAND2-3F + COMMENT-;'?' + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_dollar + OPERAND2-24 + COMMENT- + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_BS + OPERAND2-08 + COMMENT-;Back Space command character + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; diff --git a/projects/PicoBlaze/ise/Assembler/PASS3.DAT b/projects/PicoBlaze/ise/Assembler/PASS3.DAT new file mode 100644 index 0000000..3861e1b --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/PASS3.DAT @@ -0,0 +1,6048 @@ + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;KCPSM3 Program - Real Time Clock with UART communication. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Ken Chapman - Xilinx Ltd - October 2003 + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Port definitions + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_status_port + OPERAND2-00 + COMMENT-;UART status input + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_half_full + OPERAND2-01 + COMMENT-; Transmitter half full - bit0 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_full + OPERAND2-02 + COMMENT-; FIFO full - bit1 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_half_full + OPERAND2-04 + COMMENT-; Receiver half full - bit2 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_full + OPERAND2-08 + COMMENT-; FIFO full - bit3 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_data_present + OPERAND2-10 + COMMENT-; data present - bit4 + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_read_port + OPERAND2-01 + COMMENT-;UART Rx data input + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_write_port + OPERAND2-01 + COMMENT-;UART Tx data output + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_port + OPERAND2-00 + COMMENT-;Alarm output + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_control + OPERAND2-01 + COMMENT-; bit0 + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Special Register usage + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sF + OPERAND2-UART_data + COMMENT-;used to pass data to and from the UART + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sE + OPERAND2-store_pointer + COMMENT-;used to pass location of data in scratch pad memory + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Two registers to form a 16-bit counter used to count + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;interrupt pulses generated at 1us intervals. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sD + OPERAND2-int_counter_lsb + COMMENT-;lower 8-bits + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sC + OPERAND2-int_counter_msb + COMMENT-;upper 8-bits + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Scratch Pad Memory Locations + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_lsb + OPERAND2-00 + COMMENT-;16-bit micro-second time stamp + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_msb + OPERAND2-01 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_lsb + OPERAND2-02 + COMMENT-;16-bit micro-second real time value + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_msb + OPERAND2-03 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_lsb + OPERAND2-04 + COMMENT-;16-bit milli-second real time value + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_msb + OPERAND2-05 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_hours + OPERAND2-06 + COMMENT-;Current clock time + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_minutes + OPERAND2-07 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_seconds + OPERAND2-08 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_hours + OPERAND2-09 + COMMENT-;Alarm time + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_minutes + OPERAND2-0A + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_seconds + OPERAND2-0B + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_status + OPERAND2-0C + COMMENT-;Alarm status + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_active + OPERAND2-01 + COMMENT-; bit0 - Alarm is active + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_armed + OPERAND2-02 + COMMENT-; bit1 - Alarm is armed + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve0 + OPERAND2-10 + COMMENT-;storage for protection of registers + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve1 + OPERAND2-11 + COMMENT-;used by the real time clock routine. + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve2 + OPERAND2-12 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve3 + OPERAND2-13 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve4 + OPERAND2-14 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve5 + OPERAND2-15 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;UART character strings will be stored in scratch pad memory ending in carriage return. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A string can be up to 16 characters with the start location defined by this constant. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-string_start + OPERAND2-20 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Initialise the system + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-000 + LABEL-cold_start +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;clear all time values + ADDRESS-001 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_stamp_lsb + COMMENT- + ADDRESS-002 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_stamp_msb + COMMENT- + ADDRESS-003 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_lsb + COMMENT- + ADDRESS-004 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-us_time_msb + COMMENT- + ADDRESS-005 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_lsb + COMMENT- + ADDRESS-006 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_msb + COMMENT- + ADDRESS-007 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_hours + COMMENT- + ADDRESS-008 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_minutes + COMMENT- + ADDRESS-009 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-real_time_seconds + COMMENT- + ADDRESS-00A + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_hours + COMMENT- + ADDRESS-00B + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_minutes + COMMENT- + ADDRESS-00C + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_time_seconds + COMMENT- + ADDRESS-00D + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;clear and disable alarm + ADDRESS-00E + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT-;turn off alarm control output port + ADDRESS-00F + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_lsb + OPERAND2-00 + COMMENT-;clear 'us' interrupt counter + ADDRESS-010 + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_msb + OPERAND2-00 + COMMENT- + ADDRESS-011 + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT-;enable the 1us interrupts + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Start of the main program loop. + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A prompt is transmitted to the UART transmitter and then + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a command can be entered and interpreted. + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-012 + LABEL-prompt_input +INSTRUCTION-CALL + OPERAND1-send_prompt + OPERAND2- + COMMENT-;Prompt 'KCPSM3>' + ADDRESS-013 + LABEL- +INSTRUCTION-CALL + OPERAND1-receive_string + OPERAND2- + COMMENT-;obtain input string and maintain the time + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Parse the string and perform actions as required + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT- + ADDRESS-015 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-016 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return does nothing + ADDRESS-017 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-prompt_input + COMMENT- + ADDRESS-018 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_T + COMMENT-;start of 'TIME' command? + ADDRESS-019 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_for_TIME + COMMENT- + ADDRESS-01A + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_A + COMMENT-;start of 'ALARM' command? + ADDRESS-01B + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_for_ALARM + COMMENT- + ADDRESS-01C + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-01C + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;trap other command starts here + ADDRESS-01C + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-01C + LABEL-bad_input_command +INSTRUCTION-CALL + OPERAND1-send_Syntax_Error + OPERAND2- + COMMENT-;no valid command + ADDRESS-01D + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-prompt_input + COMMENT- + ADDRESS-01E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-01E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-01E + LABEL-test_for_TIME +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-01F + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_I + COMMENT-;test for rest of 'TIME' + ADDRESS-020 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-021 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-022 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_M + COMMENT- + ADDRESS-023 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-024 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-025 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_E + COMMENT- + ADDRESS-026 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-027 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;now have a valid TIME command to process + ADDRESS-027 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-028 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return means display time + ADDRESS-029 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-set_time_command + COMMENT- + ADDRESS-02A + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OPERAND2- + COMMENT-;transmit time to UART + ADDRESS-02B + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + ADDRESS-02C + LABEL-set_time_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_space + COMMENT- + ADDRESS-02D + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-02E + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OPERAND2- + COMMENT-;interpret 'hh:mm:ss' string + ADDRESS-02F + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-prompt_input + COMMENT-;test for invalid input + ADDRESS-030 + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OPERAND2-real_time_hours + COMMENT-;set new time into clock + ADDRESS-031 + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-real_time_minutes + COMMENT- + ADDRESS-032 + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-real_time_seconds + COMMENT- + ADDRESS-033 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_lsb + COMMENT-;clear 'ms' counter (s0=00) + ADDRESS-034 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-ms_time_msb + COMMENT- + ADDRESS-035 + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OPERAND2- + COMMENT-;transmit new time to UART + ADDRESS-036 + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + ADDRESS-037 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-037 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-037 + LABEL-test_for_ALARM +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-038 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_L + COMMENT-;test for rest of 'ALARM' + ADDRESS-039 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-03A + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-03B + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_A + COMMENT- + ADDRESS-03C + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-03D + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-03E + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_R + COMMENT- + ADDRESS-03F + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-040 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-041 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_M + COMMENT- + ADDRESS-042 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-043 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;now have a valid ALARM command to process + ADDRESS-043 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-044 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;carriage return means display alarm time + ADDRESS-045 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-set_alarm_command + COMMENT- + ADDRESS-046 + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit time to UART + ADDRESS-047 + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + ADDRESS-048 + LABEL-set_alarm_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_space + COMMENT-;test for ON or OFF command + ADDRESS-049 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-04A + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-04B + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_O + COMMENT- + ADDRESS-04C + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-set_alarm_on_off + COMMENT- + ADDRESS-04D + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;move memory pointer back to first character of 'hh:mm:ss' string + ADDRESS-04E + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OPERAND2- + COMMENT-;interpret 'hh:mm:ss' string + ADDRESS-04F + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-prompt_input + COMMENT-;test for invalid input + ADDRESS-050 + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OPERAND2-alarm_time_hours + COMMENT-;set new time into clock + ADDRESS-051 + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-alarm_time_minutes + COMMENT- + ADDRESS-052 + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-alarm_time_seconds + COMMENT- + ADDRESS-053 + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit new alarm time and status + ADDRESS-054 + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + ADDRESS-055 + LABEL-set_alarm_on_off +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-056 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_N + COMMENT-;test for 'ON' + ADDRESS-057 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-test_OFF + COMMENT- + ADDRESS-058 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-059 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT- + ADDRESS-05A + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-05B + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;turn alarm on + ADDRESS-05C + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT- + ADDRESS-05D + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + ADDRESS-05E + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit alarm time and status + ADDRESS-05F + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + ADDRESS-060 + LABEL-test_OFF +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_F + COMMENT-;test for for 'OFF' + ADDRESS-061 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-062 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-063 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_F + COMMENT- + ADDRESS-064 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-065 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-066 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT- + ADDRESS-067 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-bad_input_command + COMMENT- + ADDRESS-068 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;turn alarm off and stop an active alarm + ADDRESS-069 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + ADDRESS-06A + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT-;turn off alarm + ADDRESS-06B + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OPERAND2- + COMMENT-;transmit alarm time and status + ADDRESS-06C + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OPERAND2- + COMMENT- + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Read an 'hh:mm:ss' time string and provide new values. + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string must be provided in successive scratch pad memory locations + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with the s1 register containing the location of the first character. + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A correct time specification will result in the return of new values + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;as follows:- + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s6 = hours + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s5 = minutes + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s4 = seconds + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the syntax is incorrect or values are not in the correct ranges an + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;'Invalid Time' message will be transmitted and the CARRY flag will be set + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s6, s5 and s4 + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-06D + LABEL-test_time_string +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain hours value + ADDRESS-06E + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + ADDRESS-06F + LABEL- +INSTRUCTION-LOAD + OPERAND1-s6 + OPERAND2-s2 + COMMENT-;remember hours + ADDRESS-070 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past hours + ADDRESS-071 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-072 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;test for colon + ADDRESS-073 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + ADDRESS-074 + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain minutes value + ADDRESS-075 + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + ADDRESS-076 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s5 + OPERAND2-s2 + COMMENT-;remember minutes + ADDRESS-077 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past minutes + ADDRESS-078 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-079 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;test for colon + ADDRESS-07A + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + ADDRESS-07B + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OPERAND2- + COMMENT-;obtain seconds value + ADDRESS-07C + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-invalid_time + COMMENT-;test for non-decimal characters + ADDRESS-07D + LABEL- +INSTRUCTION-LOAD + OPERAND1-s4 + OPERAND2-s2 + COMMENT-;remember minutes + ADDRESS-07E + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer past seconds + ADDRESS-07F + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OPERAND2- + COMMENT- + ADDRESS-080 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;finish with carriage return + ADDRESS-081 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-invalid_time + COMMENT- + ADDRESS-082 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Have values for hh:mm:ss but need to test if each is valid range. + ADDRESS-082 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s6 + OPERAND2-hours_in_a_day + COMMENT- + ADDRESS-083 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + ADDRESS-084 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s5 + OPERAND2-minutes_in_an_hour + COMMENT- + ADDRESS-085 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + ADDRESS-086 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s4 + OPERAND2-seconds_in_a_minute + COMMENT- + ADDRESS-087 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-invalid_time + COMMENT- + ADDRESS-088 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT- + ADDRESS-089 + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OPERAND2- + COMMENT-;reset CARRY flag (with s0=0) + ADDRESS-08A + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;time string was OK + ADDRESS-08B + LABEL-invalid_time +INSTRUCTION-CALL + OPERAND1-send_Invalid + OPERAND2- + COMMENT- + ADDRESS-08C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + ADDRESS-08D + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Time + OPERAND2- + COMMENT- + ADDRESS-08E + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-01 + COMMENT- + ADDRESS-08F + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OPERAND2- + COMMENT-;set CARRY flag + ADDRESS-090 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;time string was bad + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Fetch character from memory, convert to upper case + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;and increment memory pointer. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The memory pointer is provided in register s1. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character obtained is returned in register s0. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and s1. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-091 + LABEL-fetch_char_from_memory +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT-;read character + ADDRESS-092 + LABEL- +INSTRUCTION-CALL + OPERAND1-upper_case + OPERAND2- + COMMENT-;convert to upper case + ADDRESS-093 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer + ADDRESS-094 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Read one character from the UART + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Character read will be returned in a register called 'UART_data' and will be + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;echoed to the UART transmitter. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first tests the receiver FIFO buffer to see if data is present. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the FIFO is empty, the routine waits until there is a character to read. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;As this could take any amount of time the wait loop includes a call to the + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;subroutine which updates the real time clock. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and UART_data + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-095 + LABEL-read_from_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer + ADDRESS-096 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_data_present + COMMENT- + ADDRESS-097 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-read_character + COMMENT- + ADDRESS-098 + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OPERAND2- + COMMENT-;Perform useful operation whilst waiting + ADDRESS-099 + LABEL- +INSTRUCTION-JUMP + OPERAND1-read_from_UART + OPERAND2- + COMMENT- + ADDRESS-09A + LABEL-read_character +INSTRUCTION-INPUT + OPERAND1-UART_data + OPERAND2-UART_read_port + COMMENT-;read from FIFO + ADDRESS-09B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT-;echo received character + ADDRESS-09C + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit one character to the UART + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Character supplied in register called 'UART_data'. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first tests the transmit FIFO buffer to see if it is full. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the FIFO is full, the routine waits until there is space which could + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;be as long as it takes to transmit one complete character. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Baud Rate Time per Character (10 bits) + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 9600 1,024us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 19200 521us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 38400 260us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 57600 174us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; 115200 87us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Since this is a relatively long duration, the wait loop includes a + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;call to the subroutine which updates the real time clock. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-09D + LABEL-send_to_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Tx_FIFO buffer + ADDRESS-09E + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-tx_full + COMMENT- + ADDRESS-09F + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-UART_write + COMMENT- + ADDRESS-0A0 + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OPERAND2- + COMMENT-;Perform useful operation whilst waiting + ADDRESS-0A1 + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0A2 + LABEL-UART_write +INSTRUCTION-OUTPUT + OPERAND1-UART_data + OPERAND2-UART_write_port + COMMENT- + ADDRESS-0A3 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Alarm output + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Uses the alarm status scratch pad memory to set or reset the alarm + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;control bit on the alarm output port. + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A4 + LABEL-alarm_drive +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;read status + ADDRESS-0A5 + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;isolate bit0 + ADDRESS-0A6 + LABEL- +INSTRUCTION-OUTPUT + OPERAND1-s0 + OPERAND2-alarm_port + COMMENT- + ADDRESS-0A7 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit the time to the UART port in the format hh:mm:ss and end + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with a carriage return. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will then be transmitted. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0A8 + LABEL-transmit_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OPERAND2-real_time_hours + COMMENT-;locate current time in memory + ADDRESS-0A9 + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OPERAND2- + COMMENT- + ADDRESS-0AA + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OPERAND2- + COMMENT- + ADDRESS-0AB + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;ending with carriage return. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The alarm time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will then be transmitted. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0AC + LABEL-transmit_alarm_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OPERAND2-alarm_time_hours + COMMENT-;locate alarm time in memory + ADDRESS-0AD + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OPERAND2- + COMMENT- + ADDRESS-0AE + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OPERAND2- + COMMENT- + ADDRESS-0AF + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Alarm + OPERAND2- + COMMENT- + ADDRESS-0B0 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + ADDRESS-0B1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;read alarm status + ADDRESS-0B2 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;test for active + ADDRESS-0B3 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-test_armed + COMMENT- + ADDRESS-0B4 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Active + OPERAND2- + COMMENT- + ADDRESS-0B5 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0B6 + LABEL-test_armed +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT-;test for on + ADDRESS-0B7 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-alarm_is_off + COMMENT- + ADDRESS-0B8 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_ON + OPERAND2- + COMMENT- + ADDRESS-0B9 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0BA + LABEL-alarm_is_off +INSTRUCTION-CALL + OPERAND1-send_OFF + OPERAND2- + COMMENT- + ADDRESS-0BB + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Transmit ASCII string to UART + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;An ASCII string must be provided in scratch pad memory commencing at the + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;location specified by a constant named 'string_start'. The string must + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;end with a carriage return (0D). + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s1 and 'UART_data'. + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; s0 is then used in subroutine 'send_to_UART' + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0BC + LABEL-transmit_string +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;locate start of string + ADDRESS-0BD + LABEL-next_char_tx +INSTRUCTION-FETCH + OPERAND1-UART_data + OPERAND2-(s1) + COMMENT-;read character from memory + ADDRESS-0BE + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT-;transmit character + ADDRESS-0BF + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT-;test for last character + ADDRESS-0C0 + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT- + ADDRESS-0C1 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;move to next character + ADDRESS-0C2 + LABEL- +INSTRUCTION-JUMP + OPERAND1-next_char_tx + OPERAND2- + COMMENT- + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Receive ASCII string from UART + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;An ASCII string will be read from the UART and stored in scratch pad memory + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;commencing at the location specified by a constant named 'string_start'. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string will will have a maximum length of 16 characters including a + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;carriage return (0D) denoting the end of the string. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;As each character is read, it is echoed to the UART transmitter. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Some minor editing is supported using backspace (BS=08) which is used + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;to adjust what is stored in scratch pad memory and adjust the display + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;on the terminal screen using characters sent to the UART transmitter. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;A test is made for the receiver FIFO becoming full. A full status is treated as + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a potential error situation and will result in a 'Overflow Error' message being + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;transmitted to the UART, the receiver FIFO being purged of all data and an + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;empty string being stored (carriage return at first location). + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2 and 'UART_data'. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0C3 + LABEL-receive_string +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;locate start of string + ADDRESS-0C4 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-s1 + COMMENT-;compute 16 character address + ADDRESS-0C5 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-10 + COMMENT- + ADDRESS-0C6 + LABEL-receive_full_test +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer for full + ADDRESS-0C7 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_full + COMMENT- + ADDRESS-0C8 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-read_error + COMMENT- + ADDRESS-0C9 + LABEL- +INSTRUCTION-CALL + OPERAND1-read_from_UART + OPERAND2- + COMMENT-;obtain and echo character + ADDRESS-0CA + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OPERAND2-(s1) + COMMENT-;write to memory + ADDRESS-0CB + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT-;test for end of string + ADDRESS-0CC + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT- + ADDRESS-0CD + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OPERAND2-character_BS + COMMENT-;test for back space + ADDRESS-0CE + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-BS_edit + COMMENT- + ADDRESS-0CF + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment memory pointer + ADDRESS-0D0 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-s2 + COMMENT-;test for pointer exceeding 16 characters + ADDRESS-0D1 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-receive_full_test + COMMENT-;next character + ADDRESS-0D2 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OPERAND2- + COMMENT-;hold end of string position on terminal display + ADDRESS-0D3 + LABEL-BS_edit +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;memory pointer back one + ADDRESS-0D4 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-string_start + COMMENT-;test for under flow + ADDRESS-0D5 + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-string_start_again + COMMENT- + ADDRESS-0D6 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT-;clear character at current position + ADDRESS-0D7 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OPERAND2- + COMMENT-;position cursor + ADDRESS-0D8 + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_full_test + OPERAND2- + COMMENT-;next character + ADDRESS-0D9 + LABEL-string_start_again +INSTRUCTION-CALL + OPERAND1-send_greater_than + OPERAND2- + COMMENT-;restore '>' at prompt + ADDRESS-0DA + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_string + OPERAND2- + COMMENT-;begin again + ADDRESS-0DB + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Receiver buffer overflow condition + ADDRESS-0DB + LABEL-read_error +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT-;Transmit error message + ADDRESS-0DC + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OPERAND2-string_start + COMMENT-;empty string in memory (start with CR) + ADDRESS-0DD + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Overflow_Error + OPERAND2- + COMMENT- + ADDRESS-0DE + LABEL- +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT- + ADDRESS-0DF + LABEL-clear_UART_Rx_loop +INSTRUCTION-INPUT + OPERAND1-s0 + OPERAND2-UART_status_port + COMMENT-;test Rx_FIFO buffer for data + ADDRESS-0E0 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-rx_data_present + COMMENT- + ADDRESS-0E1 + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OPERAND2- + COMMENT-;finish when buffer is empty + ADDRESS-0E2 + LABEL- +INSTRUCTION-INPUT + OPERAND1-UART_data + OPERAND2-UART_read_port + COMMENT-;read from FIFO and ignore + ADDRESS-0E3 + LABEL- +INSTRUCTION-JUMP + OPERAND1-clear_UART_Rx_loop + OPERAND2- + COMMENT- + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send Carriage Return to the UART + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E4 + LABEL-send_CR +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_CR + COMMENT- + ADDRESS-0E5 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0E6 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send a space to the UART + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0E7 + LABEL-send_space +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_space + COMMENT- + ADDRESS-0E8 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0E9 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send a back space to the UART + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0EA + LABEL-send_backspace +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_BS + COMMENT- + ADDRESS-0EB + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0EC + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-0ED + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0ED + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Syntax Error' to the UART + ADDRESS-0ED + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0ED + LABEL-send_Syntax_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_S + COMMENT- + ADDRESS-0EE + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0EF + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_y + COMMENT- + ADDRESS-0F0 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0F1 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_n + COMMENT- + ADDRESS-0F2 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0F3 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_t + COMMENT- + ADDRESS-0F4 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0F5 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + ADDRESS-0F6 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0F7 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_x + COMMENT- + ADDRESS-0F8 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0F9 + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_space_Error + OPERAND2- + COMMENT- + ADDRESS-0FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Overflow Error' to the UART + ADDRESS-0FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-0FA + LABEL-send_Overflow_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + ADDRESS-0FB + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0FC + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + ADDRESS-0FD + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-0FE + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + ADDRESS-0FF + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-100 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + ADDRESS-101 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-102 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_f + COMMENT- + ADDRESS-103 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-104 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + ADDRESS-105 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-106 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_o + COMMENT- + ADDRESS-107 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-108 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_w + COMMENT- + ADDRESS-109 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-10A + LABEL-send_space_Error +INSTRUCTION-CALL + OPERAND1-send_space + OPERAND2- + COMMENT- + ADDRESS-10B + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-10B + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Error' to the UART + ADDRESS-10B + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-10B + LABEL-send_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_E + COMMENT- + ADDRESS-10C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-10D + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + ADDRESS-10E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-10F + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-110 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_o + COMMENT- + ADDRESS-111 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-112 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + ADDRESS-113 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-114 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-115 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-115 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'KCPSM3>' prompt to the UART + ADDRESS-115 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-115 + LABEL-send_prompt +INSTRUCTION-CALL + OPERAND1-send_CR + OPERAND2- + COMMENT-;start new line + ADDRESS-116 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_K + COMMENT- + ADDRESS-117 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-118 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_C + COMMENT- + ADDRESS-119 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-11A + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_P + COMMENT- + ADDRESS-11B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-11C + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_S + COMMENT- + ADDRESS-11D + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-11E + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_M + COMMENT- + ADDRESS-11F + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-120 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_3 + COMMENT- + ADDRESS-121 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-122 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-122 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send '>' character to the UART + ADDRESS-122 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-122 + LABEL-send_greater_than +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_greater_than + COMMENT- + ADDRESS-123 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-124 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-125 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-125 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Invalid' string to the UART + ADDRESS-125 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-125 + LABEL-send_Invalid +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_I + COMMENT- + ADDRESS-126 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-127 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_n + COMMENT- + ADDRESS-128 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-129 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + ADDRESS-12A + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-12B + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + ADDRESS-12C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-12D + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + ADDRESS-12E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-12F + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + ADDRESS-130 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-131 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_d + COMMENT- + ADDRESS-132 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-133 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-134 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-134 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Time' string to the UART + ADDRESS-134 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-134 + LABEL-send_Time +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_T + COMMENT- + ADDRESS-135 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-136 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + ADDRESS-137 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-138 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_m + COMMENT- + ADDRESS-139 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-13A + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + ADDRESS-13B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-13C + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-13D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-13D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Alarm' string to the UART + ADDRESS-13D + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-13D + LABEL-send_Alarm +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_A + COMMENT- + ADDRESS-13E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-13F + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_l + COMMENT- + ADDRESS-140 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-141 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_a + COMMENT- + ADDRESS-142 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-143 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_r + COMMENT- + ADDRESS-144 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-145 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_m + COMMENT- + ADDRESS-146 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-147 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-148 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-148 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'OFF' string to the UART + ADDRESS-148 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-148 + LABEL-send_OFF +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + ADDRESS-149 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-14A + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_F + COMMENT- + ADDRESS-14B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-14C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-14D + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-14E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-14E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'ON' string to the UART + ADDRESS-14E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-14E + LABEL-send_ON +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_O + COMMENT- + ADDRESS-14F + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-150 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_N + COMMENT- + ADDRESS-151 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-152 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-153 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-153 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Send 'Active' string to the UART + ADDRESS-153 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-153 + LABEL-send_Active +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_A + COMMENT- + ADDRESS-154 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-155 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_c + COMMENT- + ADDRESS-156 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-157 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_t + COMMENT- + ADDRESS-158 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-159 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_i + COMMENT- + ADDRESS-15A + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-15B + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_v + COMMENT- + ADDRESS-15C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-15D + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OPERAND2-character_e + COMMENT- + ADDRESS-15E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OPERAND2- + COMMENT- + ADDRESS-15F + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert time to ASCII string in scratch pad memory. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;first location. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; Address Data + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer ----> hours + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The resulting ASCII string will be stored in scratch pad memory starting at + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;a location specified by a constant named 'string_start'. The string will + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;take the format hh:mm:ss and end with a carriage return. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1, s2 and 'store_pointer'. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-160 + LABEL-time_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-string_start + COMMENT-;location for string + ADDRESS-161 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read hours value + ADDRESS-162 + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + ADDRESS-163 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write hours to string + ADDRESS-164 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-165 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + ADDRESS-166 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-167 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;write ':' to string + ADDRESS-168 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + ADDRESS-169 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-16A + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OPERAND2-01 + COMMENT-;move to minutes + ADDRESS-16B + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read minutes value + ADDRESS-16C + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + ADDRESS-16D + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write minutes to string + ADDRESS-16E + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-16F + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + ADDRESS-170 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-171 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_colon + COMMENT-;write ':' to string + ADDRESS-172 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + ADDRESS-173 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-174 + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OPERAND2-01 + COMMENT-;move to seconds + ADDRESS-175 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(store_pointer) + COMMENT-;read seconds value + ADDRESS-176 + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OPERAND2- + COMMENT-;convert to ASCII + ADDRESS-177 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-(s2) + COMMENT-;write seconds to string + ADDRESS-178 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-179 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + ADDRESS-17A + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-01 + COMMENT- + ADDRESS-17B + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-character_CR + COMMENT-;finish string with carriage return + ADDRESS-17C + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-(s2) + COMMENT- + ADDRESS-17D + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert value provided in register s0 into ASCII characters + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The value provided must in the range 0 to 99 and will be converted into + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;two ASCII characters. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; The number of 'tens' will be representd by an ASCII character returned in register s1. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; The number of 'units' will be representd by an ASCII character returned in register s0. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;the actual decimal value. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0 and s1. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-17E + LABEL-decimal_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-30 + COMMENT-;load 'tens' counter with ASCII for '0' + ADDRESS-17F + LABEL-test_for_ten +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment 'tens' value + ADDRESS-180 + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OPERAND2-0A + COMMENT-;try to subtract 10 from the supplied value + ADDRESS-181 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OPERAND2-test_for_ten + COMMENT-;repeat if subtraction was possible without underflow. + ADDRESS-182 + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OPERAND2-01 + COMMENT-;'tens' value one less ten due to underflow + ADDRESS-183 + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-3A + COMMENT-;restore units value (the remainder) and convert to ASCII + ADDRESS-184 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Real Time Clock + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;micro-seconds have elapsed since the last update. This allows for just over 65ms between + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;is used to update the real time hours, minutes and seconds clock held in scratch pad + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;memory during the routine and restored before returning. + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Useful constants for real time clock operations + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_lsb + OPERAND2-E8 + COMMENT-;lower 8-bits of 1000 count value + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_msb + OPERAND2-03 + COMMENT-;upper 8-bits of 1000 count value + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-hours_in_a_day + OPERAND2-18 + COMMENT-;24 hours in a day + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-minutes_in_an_hour + OPERAND2-3C + COMMENT-;60 minutes in an hour + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-seconds_in_a_minute + OPERAND2-3C + COMMENT-;60 seconds in a minute + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-185 + LABEL-update_time +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-time_preserve0 + COMMENT-;preserve contents of registers used during routine + ADDRESS-186 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-time_preserve1 + COMMENT- + ADDRESS-187 + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-time_preserve2 + COMMENT- + ADDRESS-188 + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-time_preserve3 + COMMENT- + ADDRESS-189 + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OPERAND2-time_preserve4 + COMMENT- + ADDRESS-18A + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OPERAND2-time_preserve5 + COMMENT- + ADDRESS-18B + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-18B + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-us_time_stamp_lsb + COMMENT-;read the previous 'us' time stamp into [s3,s2] + ADDRESS-18C + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-us_time_stamp_msb + COMMENT- + ADDRESS-18D + LABEL- +INSTRUCTION-DISABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT-;Read and store current 'us' time stamp provided by the interrupt + ADDRESS-18E + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_lsb + OPERAND2-us_time_stamp_lsb + COMMENT-;counter. Interrupts are disabled to ensure that both bytes relate + ADDRESS-18F + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_msb + OPERAND2-us_time_stamp_msb + COMMENT-;to the same count value. + ADDRESS-190 + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OPERAND2- + COMMENT- + ADDRESS-191 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OPERAND2-us_time_stamp_lsb + COMMENT-;read the new 'us' time stamp in [s5,s4] + ADDRESS-192 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OPERAND2-us_time_stamp_msb + COMMENT-; + ADDRESS-193 + LABEL- +INSTRUCTION-SUB + OPERAND1-s4 + OPERAND2-s2 + COMMENT-;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + ADDRESS-194 + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s5 + OPERAND2-s3 + COMMENT-; (This works correctly even if counter has rolled over) + ADDRESS-195 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-us_time_lsb + COMMENT-;read current 'us' time into [s3,s2] + ADDRESS-196 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-us_time_msb + COMMENT- + ADDRESS-197 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s4 + COMMENT-;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + ADDRESS-198 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-s5 + COMMENT- + ADDRESS-199 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;determine how many 1000us (1ms) units there are (if any) in current 'us' time + ADDRESS-199 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;reset 'ms' counter + ADDRESS-19A + LABEL-test_1000us +INSTRUCTION-SUB + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;subtract 1000 from [s3,s2] + ADDRESS-19B + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + ADDRESS-19C + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-store_us_time + COMMENT-;Carry indicates [s3,s2] was less than 1000us + ADDRESS-19D + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-01 + COMMENT-;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + ADDRESS-19E + LABEL- +INSTRUCTION-JUMP + OPERAND1-test_1000us + OPERAND2- + COMMENT-;repeat to see if more than 1ms has elapsed + ADDRESS-19F + LABEL-store_us_time +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;add 1000 to restore 'us' value + ADDRESS-1A0 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + ADDRESS-1A1 + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-us_time_lsb + COMMENT-;store the current value of 'us' + ADDRESS-1A2 + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-us_time_msb + COMMENT- + ADDRESS-1A3 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;s0 holds the number of 'ms' elapsed since last update (if any). + ADDRESS-1A3 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-ms_time_lsb + COMMENT-;read current 'ms' time into [s3,s2] + ADDRESS-1A4 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-ms_time_msb + COMMENT- + ADDRESS-1A5 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT-;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + ADDRESS-1A6 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-00 + COMMENT- + ADDRESS-1A7 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;determine if there are now more than 1000ms to form 1 second. + ADDRESS-1A7 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OPERAND2-00 + COMMENT-;reset 'second' counter + ADDRESS-1A8 + LABEL- +INSTRUCTION-SUB + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;subtract 1000 from [s3,s2] + ADDRESS-1A9 + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + ADDRESS-1AA + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OPERAND2-restore_ms_time + COMMENT-;Carry indicates [s3,s2] was less than 1000ms + ADDRESS-1AB + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-01 + COMMENT-;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + ADDRESS-1AC + LABEL- +INSTRUCTION-JUMP + OPERAND1-store_ms_time + OPERAND2- + COMMENT-;new value of 'ms' is remainder of subtraction + ADDRESS-1AD + LABEL-restore_ms_time +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-count_1000_lsb + COMMENT-;add 1000 to restore 'ms' value + ADDRESS-1AE + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OPERAND2-count_1000_msb + COMMENT- + ADDRESS-1AF + LABEL-store_ms_time +INSTRUCTION-STORE + OPERAND1-s2 + OPERAND2-ms_time_lsb + COMMENT-;store the current value of 'ms' + ADDRESS-1B0 + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OPERAND2-ms_time_msb + COMMENT- + ADDRESS-1B1 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + ADDRESS-1B1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT-;read seconds + ADDRESS-1B2 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-s0 + COMMENT-;add one second if required by s0 + ADDRESS-1B3 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-seconds_in_a_minute + COMMENT-;test for 1 minute + ADDRESS-1B4 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-inc_minutes + COMMENT- + ADDRESS-1B5 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT-;store updated seconds + ADDRESS-1B6 + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + ADDRESS-1B7 + LABEL-inc_minutes +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;seconds become zero + ADDRESS-1B8 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_seconds + COMMENT- + ADDRESS-1B9 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT-;read minutes + ADDRESS-1BA + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment minutes + ADDRESS-1BB + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-minutes_in_an_hour + COMMENT-;test for 1 hour + ADDRESS-1BC + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-inc_hours + COMMENT- + ADDRESS-1BD + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT-;store updated minutes + ADDRESS-1BE + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + ADDRESS-1BF + LABEL-inc_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;minutes become zero + ADDRESS-1C0 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_minutes + COMMENT- + ADDRESS-1C1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT-;read hours + ADDRESS-1C2 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;increment hours + ADDRESS-1C3 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OPERAND2-hours_in_a_day + COMMENT-;test for 24 hours + ADDRESS-1C4 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-reset_hours + COMMENT- + ADDRESS-1C5 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT-;store updated hours + ADDRESS-1C6 + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OPERAND2- + COMMENT- + ADDRESS-1C7 + LABEL-reset_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OPERAND2-00 + COMMENT-;hours become zero + ADDRESS-1C8 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OPERAND2-real_time_hours + COMMENT- + ADDRESS-1C9 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1C9 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;With the time updated, there is then a test for time=alarm time + ADDRESS-1C9 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1C9 + LABEL-time_update_complete +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_hours + COMMENT- + ADDRESS-1CA + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_hours + COMMENT-;compare hours + ADDRESS-1CB + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + ADDRESS-1CC + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + ADDRESS-1CD + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_minutes + COMMENT-;compare minutes + ADDRESS-1CE + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_minutes + COMMENT- + ADDRESS-1CF + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + ADDRESS-1D0 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + ADDRESS-1D1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-real_time_seconds + COMMENT-;compare seconds + ADDRESS-1D2 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-alarm_time_seconds + COMMENT- + ADDRESS-1D3 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-s1 + COMMENT- + ADDRESS-1D4 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OPERAND2-finish_update + COMMENT- + ADDRESS-1D5 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT-;test if alarm is turned on + ADDRESS-1D6 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OPERAND2-alarm_armed + COMMENT- + ADDRESS-1D7 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OPERAND2-finish_update + COMMENT-;alarm was off + ADDRESS-1D8 + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OPERAND2-alarm_active + COMMENT-;activate alarm + ADDRESS-1D9 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OPERAND2-alarm_status + COMMENT- + ADDRESS-1DA + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OPERAND2- + COMMENT- + ADDRESS-1DB + LABEL-finish_update +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-time_preserve0 + COMMENT-;restore the register contents + ADDRESS-1DC + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OPERAND2-time_preserve1 + COMMENT- + ADDRESS-1DD + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OPERAND2-time_preserve2 + COMMENT- + ADDRESS-1DE + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OPERAND2-time_preserve3 + COMMENT- + ADDRESS-1DF + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OPERAND2-time_preserve4 + COMMENT- + ADDRESS-1E0 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OPERAND2-time_preserve5 + COMMENT- + ADDRESS-1E1 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert character to upper case + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character supplied in register s0. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;If the character is in the range 'a' to 'z', it is converted + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;to the equivalent upper case character in the range 'A' to 'Z'. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;All other characters remain unchanged. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E2 + LABEL-upper_case +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-61 + COMMENT-;eliminate character codes below 'a' (61 hex) + ADDRESS-1E3 + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT- + ADDRESS-1E4 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OPERAND2-7B + COMMENT-;eliminate character codes above 'z' (7A hex) + ADDRESS-1E5 + LABEL- +INSTRUCTION-RETURN + OPERAND1-NC + OPERAND2- + COMMENT- + ADDRESS-1E6 + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OPERAND2-DF + COMMENT-;mask bit5 to convert to upper case + ADDRESS-1E7 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Convert character '0' to '9' to numerical value in range 0 to 9 + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The character supplied in register s0. If the character is in the + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;range '0' to '9', it is converted to the equivalent decimal value. + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Characters not in the range '0' to '9' are signified by the return + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;with the CARRY flag set. + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0. + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1E8 + LABEL-1char_to_value +INSTRUCTION-ADD + OPERAND1-s0 + OPERAND2-C6 + COMMENT-;reject character codes above '9' (39 hex) + ADDRESS-1E9 + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;carry flag is set + ADDRESS-1EA + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OPERAND2-F6 + COMMENT-;reject character codes below '0' (30 hex) + ADDRESS-1EB + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT-;carry is set if value not in range + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Determine the numerical value of a two character decimal string held in + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The string must be stored as in two consecutive memory locations and the + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;location of the first (tens) character supplied in the s1 register. + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The result is provided in register s2. Strings not using characters in the + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;range '0' to '9' are signified by the return with the CARRY flag set. + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Registers used s0, s1 and s2. + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1EC + LABEL-2char_to_value +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT-;read 'tens' character + ADDRESS-1ED + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OPERAND2- + COMMENT-;convert to numerical value + ADDRESS-1EE + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;bad character - CARRY set + ADDRESS-1EF + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OPERAND2-s0 + COMMENT- + ADDRESS-1F0 + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT-;multiply 'tens' value by 10 (0A hex) + ADDRESS-1F1 + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT- + ADDRESS-1F2 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT- + ADDRESS-1F3 + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OPERAND2- + COMMENT- + ADDRESS-1F4 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OPERAND2-01 + COMMENT-;read 'units' character + ADDRESS-1F5 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OPERAND2-(s1) + COMMENT- + ADDRESS-1F6 + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OPERAND2- + COMMENT-;convert to numerical value + ADDRESS-1F7 + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OPERAND2- + COMMENT-;bad character - CARRY set + ADDRESS-1F8 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OPERAND2-s0 + COMMENT-;add units to result and clear CARRY flag + ADDRESS-1F9 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OPERAND2- + COMMENT- + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Interrupt service routine (ISR) + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The interrupt is used to increment a 16-bit counter formed with two registers + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;of micro-seconds elapsed. The counter is 'free running' in that it will count + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;up to 65,535 and then roll over to zero. The count value is then used in other + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;parts of the program as required and where it is less time critical. + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;The ISR only uses the specified counter registers + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FC + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FC + OPERAND2- + COMMENT- + ADDRESS-3FC + LABEL-ISR +INSTRUCTION-ADD + OPERAND1-int_counter_lsb + OPERAND2-01 + COMMENT-;add 1us to 16-bit counter + ADDRESS-3FD + LABEL- +INSTRUCTION-ADDCY + OPERAND1-int_counter_msb + OPERAND2-00 + COMMENT- + ADDRESS-3FE + LABEL- +INSTRUCTION-RETURNI + OPERAND1-ENABLE + OPERAND2- + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Interrupt vector + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FF + OPERAND2- + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-JUMP + OPERAND1-ISR + OPERAND2- + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;Useful constants + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-;ASCII table + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_a + OPERAND2-61 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_b + OPERAND2-62 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_c + OPERAND2-63 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_d + OPERAND2-64 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_e + OPERAND2-65 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_f + OPERAND2-66 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_g + OPERAND2-67 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_h + OPERAND2-68 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_i + OPERAND2-69 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_j + OPERAND2-6A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_k + OPERAND2-6B + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_l + OPERAND2-6C + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_m + OPERAND2-6D + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_n + OPERAND2-6E + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_o + OPERAND2-6F + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_p + OPERAND2-70 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_q + OPERAND2-71 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_r + OPERAND2-72 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_s + OPERAND2-73 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_t + OPERAND2-74 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_u + OPERAND2-75 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_v + OPERAND2-76 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_w + OPERAND2-77 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_x + OPERAND2-78 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_y + OPERAND2-79 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_z + OPERAND2-7A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_A + OPERAND2-41 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_B + OPERAND2-42 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_C + OPERAND2-43 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_D + OPERAND2-44 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_E + OPERAND2-45 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_F + OPERAND2-46 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_G + OPERAND2-47 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_H + OPERAND2-48 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_I + OPERAND2-49 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_J + OPERAND2-4A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_K + OPERAND2-4B + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_L + OPERAND2-4C + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_M + OPERAND2-4D + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_N + OPERAND2-4E + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_O + OPERAND2-4F + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_P + OPERAND2-50 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Q + OPERAND2-51 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_R + OPERAND2-52 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_S + OPERAND2-53 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_T + OPERAND2-54 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_U + OPERAND2-55 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_V + OPERAND2-56 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_W + OPERAND2-57 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_X + OPERAND2-58 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Y + OPERAND2-59 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Z + OPERAND2-5A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_0 + OPERAND2-30 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_1 + OPERAND2-31 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_2 + OPERAND2-32 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_3 + OPERAND2-33 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_4 + OPERAND2-34 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_5 + OPERAND2-35 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_6 + OPERAND2-36 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_7 + OPERAND2-37 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_8 + OPERAND2-38 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_9 + OPERAND2-39 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_colon + OPERAND2-3A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_semi_colon + OPERAND2-3B + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_less_than + OPERAND2-3C + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_greater_than + OPERAND2-3E + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_equals + OPERAND2-3D + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_space + OPERAND2-20 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_CR + OPERAND2-0D + COMMENT-;carriage return + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_question + OPERAND2-3F + COMMENT-;'?' + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_dollar + OPERAND2-24 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_BS + OPERAND2-08 + COMMENT-;Back Space command character + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OPERAND2- + COMMENT-; diff --git a/projects/PicoBlaze/ise/Assembler/PASS4.DAT b/projects/PicoBlaze/ise/Assembler/PASS4.DAT new file mode 100644 index 0000000..513ebf1 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/PASS4.DAT @@ -0,0 +1,8064 @@ + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;KCPSM3 Program - Real Time Clock with UART communication. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Ken Chapman - Xilinx Ltd - October 2003 + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Port definitions + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_status_port + OP1 VALUE-UART_status_port + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;UART status input + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_half_full + OP1 VALUE-tx_half_full + OPERAND2-01 + OP2 VALUE-01 + COMMENT-; Transmitter half full - bit0 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-tx_full + OP1 VALUE-tx_full + OPERAND2-02 + OP2 VALUE-02 + COMMENT-; FIFO full - bit1 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_half_full + OP1 VALUE-rx_half_full + OPERAND2-04 + OP2 VALUE-04 + COMMENT-; Receiver half full - bit2 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_full + OP1 VALUE-rx_full + OPERAND2-08 + OP2 VALUE-08 + COMMENT-; FIFO full - bit3 + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-rx_data_present + OP1 VALUE-rx_data_present + OPERAND2-10 + OP2 VALUE-10 + COMMENT-; data present - bit4 + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_read_port + OP1 VALUE-UART_read_port + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;UART Rx data input + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-UART_write_port + OP1 VALUE-UART_write_port + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;UART Tx data output + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_port + OP1 VALUE-alarm_port + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;Alarm output + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_control + OP1 VALUE-alarm_control + OPERAND2-01 + OP2 VALUE-01 + COMMENT-; bit0 + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Special Register usage + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sF + OP1 VALUE-sF + OPERAND2-UART_data + OP2 VALUE-UART_data + COMMENT-;used to pass data to and from the UART + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sE + OP1 VALUE-sE + OPERAND2-store_pointer + OP2 VALUE-store_pointer + COMMENT-;used to pass location of data in scratch pad memory + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Two registers to form a 16-bit counter used to count + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;interrupt pulses generated at 1us intervals. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sD + OP1 VALUE-sD + OPERAND2-int_counter_lsb + OP2 VALUE-int_counter_lsb + COMMENT-;lower 8-bits + ADDRESS-000 + LABEL- +INSTRUCTION-NAMEREG + OPERAND1-sC + OP1 VALUE-sC + OPERAND2-int_counter_msb + OP2 VALUE-int_counter_msb + COMMENT-;upper 8-bits + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Scratch Pad Memory Locations + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_lsb + OP1 VALUE-us_time_stamp_lsb + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;16-bit micro-second time stamp + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_msb + OP1 VALUE-us_time_stamp_msb + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_lsb + OP1 VALUE-us_time_lsb + OPERAND2-02 + OP2 VALUE-02 + COMMENT-;16-bit micro-second real time value + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-us_time_msb + OP1 VALUE-us_time_msb + OPERAND2-03 + OP2 VALUE-03 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_lsb + OP1 VALUE-ms_time_lsb + OPERAND2-04 + OP2 VALUE-04 + COMMENT-;16-bit milli-second real time value + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-ms_time_msb + OP1 VALUE-ms_time_msb + OPERAND2-05 + OP2 VALUE-05 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_hours + OP1 VALUE-real_time_hours + OPERAND2-06 + OP2 VALUE-06 + COMMENT-;Current clock time + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_minutes + OP1 VALUE-real_time_minutes + OPERAND2-07 + OP2 VALUE-07 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-real_time_seconds + OP1 VALUE-real_time_seconds + OPERAND2-08 + OP2 VALUE-08 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_hours + OP1 VALUE-alarm_time_hours + OPERAND2-09 + OP2 VALUE-09 + COMMENT-;Alarm time + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_minutes + OP1 VALUE-alarm_time_minutes + OPERAND2-0A + OP2 VALUE-0A + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_seconds + OP1 VALUE-alarm_time_seconds + OPERAND2-0B + OP2 VALUE-0B + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_status + OP1 VALUE-alarm_status + OPERAND2-0C + OP2 VALUE-0C + COMMENT-;Alarm status + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_active + OP1 VALUE-alarm_active + OPERAND2-01 + OP2 VALUE-01 + COMMENT-; bit0 - Alarm is active + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-alarm_armed + OP1 VALUE-alarm_armed + OPERAND2-02 + OP2 VALUE-02 + COMMENT-; bit1 - Alarm is armed + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve0 + OP1 VALUE-time_preserve0 + OPERAND2-10 + OP2 VALUE-10 + COMMENT-;storage for protection of registers + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve1 + OP1 VALUE-time_preserve1 + OPERAND2-11 + OP2 VALUE-11 + COMMENT-;used by the real time clock routine. + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve2 + OP1 VALUE-time_preserve2 + OPERAND2-12 + OP2 VALUE-12 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve3 + OP1 VALUE-time_preserve3 + OPERAND2-13 + OP2 VALUE-13 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve4 + OP1 VALUE-time_preserve4 + OPERAND2-14 + OP2 VALUE-14 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-time_preserve5 + OP1 VALUE-time_preserve5 + OPERAND2-15 + OP2 VALUE-15 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;UART character strings will be stored in scratch pad memory ending in carriage return. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A string can be up to 16 characters with the start location defined by this constant. + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-string_start + OP1 VALUE-string_start + OPERAND2-20 + OP2 VALUE-20 + COMMENT- + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Initialise the system + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL-cold_start +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;clear all time values + ADDRESS-001 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT- + ADDRESS-002 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT- + ADDRESS-003 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_lsb + OP2 VALUE-02 + COMMENT- + ADDRESS-004 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-005 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT- + ADDRESS-006 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-007 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT- + ADDRESS-008 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT- + ADDRESS-009 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT- + ADDRESS-00A + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT- + ADDRESS-00B + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_time_minutes + OP2 VALUE-0A + COMMENT- + ADDRESS-00C + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_time_seconds + OP2 VALUE-0B + COMMENT- + ADDRESS-00D + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;clear and disable alarm + ADDRESS-00E + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OP1 VALUE-0A4 + OPERAND2- + OP2 VALUE- + COMMENT-;turn off alarm control output port + ADDRESS-00F + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_lsb + OP1 VALUE-sD + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;clear 'us' interrupt counter + ADDRESS-010 + LABEL- +INSTRUCTION-LOAD + OPERAND1-int_counter_msb + OP1 VALUE-sC + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-011 + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OP1 VALUE-INTERRUPT + OPERAND2- + OP2 VALUE- + COMMENT-;enable the 1us interrupts + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Start of the main program loop. + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A prompt is transmitted to the UART transmitter and then + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;a command can be entered and interpreted. + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL-prompt_input +INSTRUCTION-CALL + OPERAND1-send_prompt + OP1 VALUE-115 + OPERAND2- + OP2 VALUE- + COMMENT-;Prompt 'KCPSM3>' + ADDRESS-013 + LABEL- +INSTRUCTION-CALL + OPERAND1-receive_string + OP1 VALUE-0C3 + OPERAND2- + OP2 VALUE- + COMMENT-;obtain input string and maintain the time + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Parse the string and perform actions as required + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT- + ADDRESS-015 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-016 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;carriage return does nothing + ADDRESS-017 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT- + ADDRESS-018 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_T + OP2 VALUE-54 + COMMENT-;start of 'TIME' command? + ADDRESS-019 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-test_for_TIME + OP2 VALUE-01E + COMMENT- + ADDRESS-01A + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_A + OP2 VALUE-41 + COMMENT-;start of 'ALARM' command? + ADDRESS-01B + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-test_for_ALARM + OP2 VALUE-037 + COMMENT- + ADDRESS-01C + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01C + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;trap other command starts here + ADDRESS-01C + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01C + LABEL-bad_input_command +INSTRUCTION-CALL + OPERAND1-send_Syntax_Error + OP1 VALUE-0ED + OPERAND2- + OP2 VALUE- + COMMENT-;no valid command + ADDRESS-01D + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT- + ADDRESS-01E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01E + LABEL-test_for_TIME +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-01F + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_I + OP2 VALUE-49 + COMMENT-;test for rest of 'TIME' + ADDRESS-020 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-021 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-022 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_M + OP2 VALUE-4D + COMMENT- + ADDRESS-023 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-024 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-025 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_E + OP2 VALUE-45 + COMMENT- + ADDRESS-026 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-027 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;now have a valid TIME command to process + ADDRESS-027 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-028 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;carriage return means display time + ADDRESS-029 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-set_time_command + OP2 VALUE-02C + COMMENT- + ADDRESS-02A + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OP1 VALUE-0A8 + OPERAND2- + OP2 VALUE- + COMMENT-;transmit time to UART + ADDRESS-02B + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-02C + LABEL-set_time_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_space + OP2 VALUE-20 + COMMENT- + ADDRESS-02D + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-02E + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OP1 VALUE-06D + OPERAND2- + OP2 VALUE- + COMMENT-;interpret 'hh:mm:ss' string + ADDRESS-02F + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT-;test for invalid input + ADDRESS-030 + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;set new time into clock + ADDRESS-031 + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT- + ADDRESS-032 + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT- + ADDRESS-033 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT-;clear 'ms' counter (s0=00) + ADDRESS-034 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-035 + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_time + OP1 VALUE-0A8 + OPERAND2- + OP2 VALUE- + COMMENT-;transmit new time to UART + ADDRESS-036 + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-037 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-037 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-037 + LABEL-test_for_ALARM +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-038 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_L + OP2 VALUE-4C + COMMENT-;test for rest of 'ALARM' + ADDRESS-039 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-03A + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-03B + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_A + OP2 VALUE-41 + COMMENT- + ADDRESS-03C + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-03D + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-03E + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_R + OP2 VALUE-52 + COMMENT- + ADDRESS-03F + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-040 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-041 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_M + OP2 VALUE-4D + COMMENT- + ADDRESS-042 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-043 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;now have a valid ALARM command to process + ADDRESS-043 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-044 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;carriage return means display alarm time + ADDRESS-045 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-set_alarm_command + OP2 VALUE-048 + COMMENT- + ADDRESS-046 + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit time to UART + ADDRESS-047 + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-048 + LABEL-set_alarm_command +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_space + OP2 VALUE-20 + COMMENT-;test for ON or OFF command + ADDRESS-049 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-04A + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-04B + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-04C + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-set_alarm_on_off + OP2 VALUE-055 + COMMENT- + ADDRESS-04D + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move memory pointer back to first character of 'hh:mm:ss' string + ADDRESS-04E + LABEL- +INSTRUCTION-CALL + OPERAND1-test_time_string + OP1 VALUE-06D + OPERAND2- + OP2 VALUE- + COMMENT-;interpret 'hh:mm:ss' string + ADDRESS-04F + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT-;test for invalid input + ADDRESS-050 + LABEL- +INSTRUCTION-STORE + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT-;set new time into clock + ADDRESS-051 + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-alarm_time_minutes + OP2 VALUE-0A + COMMENT- + ADDRESS-052 + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-alarm_time_seconds + OP2 VALUE-0B + COMMENT- + ADDRESS-053 + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit new alarm time and status + ADDRESS-054 + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-055 + LABEL-set_alarm_on_off +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-056 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_N + OP2 VALUE-4E + COMMENT-;test for 'ON' + ADDRESS-057 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-test_OFF + OP2 VALUE-060 + COMMENT- + ADDRESS-058 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-059 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT- + ADDRESS-05A + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-05B + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;turn alarm on + ADDRESS-05C + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_armed + OP2 VALUE-02 + COMMENT- + ADDRESS-05D + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT- + ADDRESS-05E + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit alarm time and status + ADDRESS-05F + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-060 + LABEL-test_OFF +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_F + OP2 VALUE-46 + COMMENT-;test for for 'OFF' + ADDRESS-061 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-062 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-063 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_F + OP2 VALUE-46 + COMMENT- + ADDRESS-064 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-065 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-066 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT- + ADDRESS-067 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-068 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;turn alarm off and stop an active alarm + ADDRESS-069 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT- + ADDRESS-06A + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OP1 VALUE-0A4 + OPERAND2- + OP2 VALUE- + COMMENT-;turn off alarm + ADDRESS-06B + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit alarm time and status + ADDRESS-06C + LABEL- +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Read an 'hh:mm:ss' time string and provide new values. + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string must be provided in successive scratch pad memory locations + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;with the s1 register containing the location of the first character. + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A correct time specification will result in the return of new values + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;as follows:- + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s6 = hours + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s5 = minutes + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s4 = seconds + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the syntax is incorrect or values are not in the correct ranges an + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;'Invalid Time' message will be transmitted and the CARRY flag will be set + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s6, s5 and s4 + ADDRESS-06D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL-test_time_string +INSTRUCTION-CALL + OPERAND1-2char_to_value + OP1 VALUE-1EC + OPERAND2- + OP2 VALUE- + COMMENT-;obtain hours value + ADDRESS-06E + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT-;test for non-decimal characters + ADDRESS-06F + LABEL- +INSTRUCTION-LOAD + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;remember hours + ADDRESS-070 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer past hours + ADDRESS-071 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-072 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;test for colon + ADDRESS-073 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-074 + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OP1 VALUE-1EC + OPERAND2- + OP2 VALUE- + COMMENT-;obtain minutes value + ADDRESS-075 + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT-;test for non-decimal characters + ADDRESS-076 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;remember minutes + ADDRESS-077 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer past minutes + ADDRESS-078 + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-079 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;test for colon + ADDRESS-07A + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-07B + LABEL- +INSTRUCTION-CALL + OPERAND1-2char_to_value + OP1 VALUE-1EC + OPERAND2- + OP2 VALUE- + COMMENT-;obtain seconds value + ADDRESS-07C + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT-;test for non-decimal characters + ADDRESS-07D + LABEL- +INSTRUCTION-LOAD + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;remember minutes + ADDRESS-07E + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer past seconds + ADDRESS-07F + LABEL- +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-080 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;finish with carriage return + ADDRESS-081 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-082 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Have values for hh:mm:ss but need to test if each is valid range. + ADDRESS-082 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-hours_in_a_day + OP2 VALUE-18 + COMMENT- + ADDRESS-083 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-084 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-minutes_in_an_hour + OP2 VALUE-3C + COMMENT- + ADDRESS-085 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-086 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-seconds_in_a_minute + OP2 VALUE-3C + COMMENT- + ADDRESS-087 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-088 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-089 + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2- + OP2 VALUE- + COMMENT-;reset CARRY flag (with s0=0) + ADDRESS-08A + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;time string was OK + ADDRESS-08B + LABEL-invalid_time +INSTRUCTION-CALL + OPERAND1-send_Invalid + OP1 VALUE-125 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-08C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-08D + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Time + OP1 VALUE-134 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-08E + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-08F + LABEL- +INSTRUCTION-SR0 + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2- + OP2 VALUE- + COMMENT-;set CARRY flag + ADDRESS-090 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;time string was bad + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Fetch character from memory, convert to upper case + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;and increment memory pointer. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The memory pointer is provided in register s1. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The character obtained is returned in register s0. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 and s1. + ADDRESS-091 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL-fetch_char_from_memory +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;read character + ADDRESS-092 + LABEL- +INSTRUCTION-CALL + OPERAND1-upper_case + OP1 VALUE-1E2 + OPERAND2- + OP2 VALUE- + COMMENT-;convert to upper case + ADDRESS-093 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer + ADDRESS-094 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Read one character from the UART + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Character read will be returned in a register called 'UART_data' and will be + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;echoed to the UART transmitter. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first tests the receiver FIFO buffer to see if data is present. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the FIFO is empty, the routine waits until there is a character to read. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;As this could take any amount of time the wait loop includes a call to the + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;subroutine which updates the real time clock. + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 and UART_data + ADDRESS-095 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL-read_from_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Rx_FIFO buffer + ADDRESS-096 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-rx_data_present + OP2 VALUE-10 + COMMENT- + ADDRESS-097 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-read_character + OP2 VALUE-09A + COMMENT- + ADDRESS-098 + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OP1 VALUE-185 + OPERAND2- + OP2 VALUE- + COMMENT-;Perform useful operation whilst waiting + ADDRESS-099 + LABEL- +INSTRUCTION-JUMP + OPERAND1-read_from_UART + OP1 VALUE-095 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-09A + LABEL-read_character +INSTRUCTION-INPUT + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-UART_read_port + OP2 VALUE-01 + COMMENT-;read from FIFO + ADDRESS-09B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT-;echo received character + ADDRESS-09C + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit one character to the UART + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Character supplied in register called 'UART_data'. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first tests the transmit FIFO buffer to see if it is full. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the FIFO is full, the routine waits until there is space which could + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;be as long as it takes to transmit one complete character. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Baud Rate Time per Character (10 bits) + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 9600 1,024us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 19200 521us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 38400 260us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 57600 174us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 115200 87us + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Since this is a relatively long duration, the wait loop includes a + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;call to the subroutine which updates the real time clock. + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 + ADDRESS-09D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL-send_to_UART +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Tx_FIFO buffer + ADDRESS-09E + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-tx_full + OP2 VALUE-02 + COMMENT- + ADDRESS-09F + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-UART_write + OP2 VALUE-0A2 + COMMENT- + ADDRESS-0A0 + LABEL- +INSTRUCTION-CALL + OPERAND1-update_time + OP1 VALUE-185 + OPERAND2- + OP2 VALUE- + COMMENT-;Perform useful operation whilst waiting + ADDRESS-0A1 + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0A2 + LABEL-UART_write +INSTRUCTION-OUTPUT + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-UART_write_port + OP2 VALUE-01 + COMMENT- + ADDRESS-0A3 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Alarm output + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Uses the alarm status scratch pad memory to set or reset the alarm + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;control bit on the alarm output port. + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 + ADDRESS-0A4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL-alarm_drive +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;read status + ADDRESS-0A5 + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_active + OP2 VALUE-01 + COMMENT-;isolate bit0 + ADDRESS-0A6 + LABEL- +INSTRUCTION-OUTPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_port + OP2 VALUE-00 + COMMENT- + ADDRESS-0A7 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit the time to the UART port in the format hh:mm:ss and end + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;with a carriage return. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;first location. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Address Data + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer ----> hours + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string will then be transmitted. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ADDRESS-0A8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL-transmit_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;locate current time in memory + ADDRESS-0A9 + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OP1 VALUE-160 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AA + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OP1 VALUE-0BC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AB + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;ending with carriage return. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The alarm time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;first location. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Address Data + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer ----> hours + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string will then be transmitted. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ADDRESS-0AC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL-transmit_alarm_time +INSTRUCTION-LOAD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT-;locate alarm time in memory + ADDRESS-0AD + LABEL- +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OP1 VALUE-160 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AE + LABEL- +INSTRUCTION-CALL + OPERAND1-transmit_string + OP1 VALUE-0BC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AF + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Alarm + OP1 VALUE-13D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B0 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;read alarm status + ADDRESS-0B2 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_active + OP2 VALUE-01 + COMMENT-;test for active + ADDRESS-0B3 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-test_armed + OP2 VALUE-0B6 + COMMENT- + ADDRESS-0B4 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Active + OP1 VALUE-153 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B5 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B6 + LABEL-test_armed +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_armed + OP2 VALUE-02 + COMMENT-;test for on + ADDRESS-0B7 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-alarm_is_off + OP2 VALUE-0BA + COMMENT- + ADDRESS-0B8 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_ON + OP1 VALUE-14E + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B9 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0BA + LABEL-alarm_is_off +INSTRUCTION-CALL + OPERAND1-send_OFF + OP1 VALUE-148 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0BB + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit ASCII string to UART + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;An ASCII string must be provided in scratch pad memory commencing at the + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;location specified by a constant named 'string_start'. The string must + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;end with a carriage return (0D). + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s1 and 'UART_data'. + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s0 is then used in subroutine 'send_to_UART' + ADDRESS-0BC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL-transmit_string +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;locate start of string + ADDRESS-0BD + LABEL-next_char_tx +INSTRUCTION-FETCH + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;read character from memory + ADDRESS-0BE + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT-;transmit character + ADDRESS-0BF + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;test for last character + ADDRESS-0C0 + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OP1 VALUE-Z + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0C1 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move to next character + ADDRESS-0C2 + LABEL- +INSTRUCTION-JUMP + OPERAND1-next_char_tx + OP1 VALUE-0BD + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Receive ASCII string from UART + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;An ASCII string will be read from the UART and stored in scratch pad memory + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;commencing at the location specified by a constant named 'string_start'. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string will will have a maximum length of 16 characters including a + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;carriage return (0D) denoting the end of the string. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;As each character is read, it is echoed to the UART transmitter. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Some minor editing is supported using backspace (BS=08) which is used + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;to adjust what is stored in scratch pad memory and adjust the display + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;on the terminal screen using characters sent to the UART transmitter. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A test is made for the receiver FIFO becoming full. A full status is treated as + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;a potential error situation and will result in a 'Overflow Error' message being + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;transmitted to the UART, the receiver FIFO being purged of all data and an + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;empty string being stored (carriage return at first location). + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2 and 'UART_data'. + ADDRESS-0C3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL-receive_string +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;locate start of string + ADDRESS-0C4 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT-;compute 16 character address + ADDRESS-0C5 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-10 + OP2 VALUE-10 + COMMENT- + ADDRESS-0C6 + LABEL-receive_full_test +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Rx_FIFO buffer for full + ADDRESS-0C7 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-rx_full + OP2 VALUE-08 + COMMENT- + ADDRESS-0C8 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-read_error + OP2 VALUE-0DB + COMMENT- + ADDRESS-0C9 + LABEL- +INSTRUCTION-CALL + OPERAND1-read_from_UART + OP1 VALUE-095 + OPERAND2- + OP2 VALUE- + COMMENT-;obtain and echo character + ADDRESS-0CA + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;write to memory + ADDRESS-0CB + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;test for end of string + ADDRESS-0CC + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OP1 VALUE-Z + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0CD + LABEL- +INSTRUCTION-COMPARE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_BS + OP2 VALUE-08 + COMMENT-;test for back space + ADDRESS-0CE + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-BS_edit + OP2 VALUE-0D3 + COMMENT- + ADDRESS-0CF + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer + ADDRESS-0D0 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;test for pointer exceeding 16 characters + ADDRESS-0D1 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-receive_full_test + OP2 VALUE-0C6 + COMMENT-;next character + ADDRESS-0D2 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OP1 VALUE-0EA + OPERAND2- + OP2 VALUE- + COMMENT-;hold end of string position on terminal display + ADDRESS-0D3 + LABEL-BS_edit +INSTRUCTION-SUB + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;memory pointer back one + ADDRESS-0D4 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;test for under flow + ADDRESS-0D5 + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-string_start_again + OP2 VALUE-0D9 + COMMENT- + ADDRESS-0D6 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT-;clear character at current position + ADDRESS-0D7 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_backspace + OP1 VALUE-0EA + OPERAND2- + OP2 VALUE- + COMMENT-;position cursor + ADDRESS-0D8 + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_full_test + OP1 VALUE-0C6 + OPERAND2- + OP2 VALUE- + COMMENT-;next character + ADDRESS-0D9 + LABEL-string_start_again +INSTRUCTION-CALL + OPERAND1-send_greater_than + OP1 VALUE-122 + OPERAND2- + OP2 VALUE- + COMMENT-;restore '>' at prompt + ADDRESS-0DA + LABEL- +INSTRUCTION-JUMP + OPERAND1-receive_string + OP1 VALUE-0C3 + OPERAND2- + OP2 VALUE- + COMMENT-;begin again + ADDRESS-0DB + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Receiver buffer overflow condition + ADDRESS-0DB + LABEL-read_error +INSTRUCTION-CALL + OPERAND1-send_CR + OP1 VALUE-0E4 + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit error message + ADDRESS-0DC + LABEL- +INSTRUCTION-STORE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;empty string in memory (start with CR) + ADDRESS-0DD + LABEL- +INSTRUCTION-CALL + OPERAND1-send_Overflow_Error + OP1 VALUE-0FA + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0DE + LABEL- +INSTRUCTION-CALL + OPERAND1-send_CR + OP1 VALUE-0E4 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0DF + LABEL-clear_UART_Rx_loop +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Rx_FIFO buffer for data + ADDRESS-0E0 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-rx_data_present + OP2 VALUE-10 + COMMENT- + ADDRESS-0E1 + LABEL- +INSTRUCTION-RETURN + OPERAND1-Z + OP1 VALUE-Z + OPERAND2- + OP2 VALUE- + COMMENT-;finish when buffer is empty + ADDRESS-0E2 + LABEL- +INSTRUCTION-INPUT + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-UART_read_port + OP2 VALUE-01 + COMMENT-;read from FIFO and ignore + ADDRESS-0E3 + LABEL- +INSTRUCTION-JUMP + OPERAND1-clear_UART_Rx_loop + OP1 VALUE-0DF + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send Carriage Return to the UART + ADDRESS-0E4 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL-send_CR +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT- + ADDRESS-0E5 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E6 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send a space to the UART + ADDRESS-0E7 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL-send_space +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_space + OP2 VALUE-20 + COMMENT- + ADDRESS-0E8 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E9 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send a back space to the UART + ADDRESS-0EA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0EA + LABEL-send_backspace +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_BS + OP2 VALUE-08 + COMMENT- + ADDRESS-0EB + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0EC + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0ED + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0ED + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Syntax Error' to the UART + ADDRESS-0ED + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0ED + LABEL-send_Syntax_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_S + OP2 VALUE-53 + COMMENT- + ADDRESS-0EE + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0EF + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_y + OP2 VALUE-79 + COMMENT- + ADDRESS-0F0 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F1 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_n + OP2 VALUE-6E + COMMENT- + ADDRESS-0F2 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F3 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_t + OP2 VALUE-74 + COMMENT- + ADDRESS-0F4 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F5 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_a + OP2 VALUE-61 + COMMENT- + ADDRESS-0F6 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F7 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_x + OP2 VALUE-78 + COMMENT- + ADDRESS-0F8 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F9 + LABEL- +INSTRUCTION-JUMP + OPERAND1-send_space_Error + OP1 VALUE-10A + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Overflow Error' to the UART + ADDRESS-0FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0FA + LABEL-send_Overflow_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-0FB + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0FC + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_v + OP2 VALUE-76 + COMMENT- + ADDRESS-0FD + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0FE + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_e + OP2 VALUE-65 + COMMENT- + ADDRESS-0FF + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-100 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-101 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-102 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_f + OP2 VALUE-66 + COMMENT- + ADDRESS-103 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-104 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_l + OP2 VALUE-6C + COMMENT- + ADDRESS-105 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-106 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_o + OP2 VALUE-6F + COMMENT- + ADDRESS-107 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-108 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_w + OP2 VALUE-77 + COMMENT- + ADDRESS-109 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10A + LABEL-send_space_Error +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10B + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-10B + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Error' to the UART + ADDRESS-10B + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-10B + LABEL-send_Error +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_E + OP2 VALUE-45 + COMMENT- + ADDRESS-10C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10D + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-10E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10F + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-110 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_o + OP2 VALUE-6F + COMMENT- + ADDRESS-111 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-112 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-113 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-114 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-115 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-115 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'KCPSM3>' prompt to the UART + ADDRESS-115 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-115 + LABEL-send_prompt +INSTRUCTION-CALL + OPERAND1-send_CR + OP1 VALUE-0E4 + OPERAND2- + OP2 VALUE- + COMMENT-;start new line + ADDRESS-116 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_K + OP2 VALUE-4B + COMMENT- + ADDRESS-117 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-118 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_C + OP2 VALUE-43 + COMMENT- + ADDRESS-119 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-11A + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_P + OP2 VALUE-50 + COMMENT- + ADDRESS-11B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-11C + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_S + OP2 VALUE-53 + COMMENT- + ADDRESS-11D + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-11E + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_M + OP2 VALUE-4D + COMMENT- + ADDRESS-11F + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-120 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_3 + OP2 VALUE-33 + COMMENT- + ADDRESS-121 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-122 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-122 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send '>' character to the UART + ADDRESS-122 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-122 + LABEL-send_greater_than +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_greater_than + OP2 VALUE-3E + COMMENT- + ADDRESS-123 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-124 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-125 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-125 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Invalid' string to the UART + ADDRESS-125 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-125 + LABEL-send_Invalid +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_I + OP2 VALUE-49 + COMMENT- + ADDRESS-126 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-127 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_n + OP2 VALUE-6E + COMMENT- + ADDRESS-128 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-129 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_v + OP2 VALUE-76 + COMMENT- + ADDRESS-12A + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-12B + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_a + OP2 VALUE-61 + COMMENT- + ADDRESS-12C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-12D + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_l + OP2 VALUE-6C + COMMENT- + ADDRESS-12E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-12F + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_i + OP2 VALUE-69 + COMMENT- + ADDRESS-130 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-131 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_d + OP2 VALUE-64 + COMMENT- + ADDRESS-132 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-133 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-134 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-134 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Time' string to the UART + ADDRESS-134 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-134 + LABEL-send_Time +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_T + OP2 VALUE-54 + COMMENT- + ADDRESS-135 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-136 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_i + OP2 VALUE-69 + COMMENT- + ADDRESS-137 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-138 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_m + OP2 VALUE-6D + COMMENT- + ADDRESS-139 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13A + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_e + OP2 VALUE-65 + COMMENT- + ADDRESS-13B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13C + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-13D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Alarm' string to the UART + ADDRESS-13D + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-13D + LABEL-send_Alarm +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_A + OP2 VALUE-41 + COMMENT- + ADDRESS-13E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13F + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_l + OP2 VALUE-6C + COMMENT- + ADDRESS-140 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-141 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_a + OP2 VALUE-61 + COMMENT- + ADDRESS-142 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-143 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-144 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-145 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_m + OP2 VALUE-6D + COMMENT- + ADDRESS-146 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-147 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-148 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-148 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'OFF' string to the UART + ADDRESS-148 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-148 + LABEL-send_OFF +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-149 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14A + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_F + OP2 VALUE-46 + COMMENT- + ADDRESS-14B + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14D + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-14E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'ON' string to the UART + ADDRESS-14E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-14E + LABEL-send_ON +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-14F + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-150 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_N + OP2 VALUE-4E + COMMENT- + ADDRESS-151 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-152 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-153 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-153 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Active' string to the UART + ADDRESS-153 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-153 + LABEL-send_Active +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_A + OP2 VALUE-41 + COMMENT- + ADDRESS-154 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-155 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_c + OP2 VALUE-63 + COMMENT- + ADDRESS-156 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-157 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_t + OP2 VALUE-74 + COMMENT- + ADDRESS-158 + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-159 + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_i + OP2 VALUE-69 + COMMENT- + ADDRESS-15A + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-15B + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_v + OP2 VALUE-76 + COMMENT- + ADDRESS-15C + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-15D + LABEL- +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_e + OP2 VALUE-65 + COMMENT- + ADDRESS-15E + LABEL- +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-15F + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert time to ASCII string in scratch pad memory. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;first location. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Address Data + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer ----> hours + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The resulting ASCII string will be stored in scratch pad memory starting at + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;a location specified by a constant named 'string_start'. The string will + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;take the format hh:mm:ss and end with a carriage return. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2 and 'store_pointer'. + ADDRESS-160 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL-time_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;location for string + ADDRESS-161 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(store_pointer) + OP2 VALUE-(sE) + COMMENT-;read hours value + ADDRESS-162 + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OP1 VALUE-17E + OPERAND2- + OP2 VALUE- + COMMENT-;convert to ASCII + ADDRESS-163 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT-;write hours to string + ADDRESS-164 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-165 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-166 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-167 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;write ':' to string + ADDRESS-168 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-169 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-16A + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move to minutes + ADDRESS-16B + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(store_pointer) + OP2 VALUE-(sE) + COMMENT-;read minutes value + ADDRESS-16C + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OP1 VALUE-17E + OPERAND2- + OP2 VALUE- + COMMENT-;convert to ASCII + ADDRESS-16D + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT-;write minutes to string + ADDRESS-16E + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-16F + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-170 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-171 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;write ':' to string + ADDRESS-172 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-173 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-174 + LABEL- +INSTRUCTION-ADD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move to seconds + ADDRESS-175 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(store_pointer) + OP2 VALUE-(sE) + COMMENT-;read seconds value + ADDRESS-176 + LABEL- +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OP1 VALUE-17E + OPERAND2- + OP2 VALUE- + COMMENT-;convert to ASCII + ADDRESS-177 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT-;write seconds to string + ADDRESS-178 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-179 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-17A + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-17B + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;finish string with carriage return + ADDRESS-17C + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-17D + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert value provided in register s0 into ASCII characters + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The value provided must in the range 0 to 99 and will be converted into + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;two ASCII characters. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; The number of 'tens' will be representd by an ASCII character returned in register s1. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; The number of 'units' will be representd by an ASCII character returned in register s0. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;the actual decimal value. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 and s1. + ADDRESS-17E + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL-decimal_to_ASCII +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-30 + OP2 VALUE-30 + COMMENT-;load 'tens' counter with ASCII for '0' + ADDRESS-17F + LABEL-test_for_ten +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment 'tens' value + ADDRESS-180 + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-0A + OP2 VALUE-0A + COMMENT-;try to subtract 10 from the supplied value + ADDRESS-181 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-test_for_ten + OP2 VALUE-17F + COMMENT-;repeat if subtraction was possible without underflow. + ADDRESS-182 + LABEL- +INSTRUCTION-SUB + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;'tens' value one less ten due to underflow + ADDRESS-183 + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-3A + OP2 VALUE-3A + COMMENT-;restore units value (the remainder) and convert to ASCII + ADDRESS-184 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Real Time Clock + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;micro-seconds have elapsed since the last update. This allows for just over 65ms between + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;is used to update the real time hours, minutes and seconds clock held in scratch pad + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;memory during the routine and restored before returning. + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Useful constants for real time clock operations + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_lsb + OP1 VALUE-count_1000_lsb + OPERAND2-E8 + OP2 VALUE-E8 + COMMENT-;lower 8-bits of 1000 count value + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-count_1000_msb + OP1 VALUE-count_1000_msb + OPERAND2-03 + OP2 VALUE-03 + COMMENT-;upper 8-bits of 1000 count value + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-hours_in_a_day + OP1 VALUE-hours_in_a_day + OPERAND2-18 + OP2 VALUE-18 + COMMENT-;24 hours in a day + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-minutes_in_an_hour + OP1 VALUE-minutes_in_an_hour + OPERAND2-3C + OP2 VALUE-3C + COMMENT-;60 minutes in an hour + ADDRESS-185 + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-seconds_in_a_minute + OP1 VALUE-seconds_in_a_minute + OPERAND2-3C + OP2 VALUE-3C + COMMENT-;60 seconds in a minute + ADDRESS-185 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL-update_time +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-time_preserve0 + OP2 VALUE-10 + COMMENT-;preserve contents of registers used during routine + ADDRESS-186 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-time_preserve1 + OP2 VALUE-11 + COMMENT- + ADDRESS-187 + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-time_preserve2 + OP2 VALUE-12 + COMMENT- + ADDRESS-188 + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-time_preserve3 + OP2 VALUE-13 + COMMENT- + ADDRESS-189 + LABEL- +INSTRUCTION-STORE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-time_preserve4 + OP2 VALUE-14 + COMMENT- + ADDRESS-18A + LABEL- +INSTRUCTION-STORE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-time_preserve5 + OP2 VALUE-15 + COMMENT- + ADDRESS-18B + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-18B + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT-;read the previous 'us' time stamp into [s3,s2] + ADDRESS-18C + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT- + ADDRESS-18D + LABEL- +INSTRUCTION-DISABLE + OPERAND1-INTERRUPT + OP1 VALUE-INTERRUPT + OPERAND2- + OP2 VALUE- + COMMENT-;Read and store current 'us' time stamp provided by the interrupt + ADDRESS-18E + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_lsb + OP1 VALUE-sD + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT-;counter. Interrupts are disabled to ensure that both bytes relate + ADDRESS-18F + LABEL- +INSTRUCTION-STORE + OPERAND1-int_counter_msb + OP1 VALUE-sC + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT-;to the same count value. + ADDRESS-190 + LABEL- +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OP1 VALUE-INTERRUPT + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-191 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT-;read the new 'us' time stamp in [s5,s4] + ADDRESS-192 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT-; + ADDRESS-193 + LABEL- +INSTRUCTION-SUB + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + ADDRESS-194 + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-s3 + OP2 VALUE-s3 + COMMENT-; (This works correctly even if counter has rolled over) + ADDRESS-195 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-us_time_lsb + OP2 VALUE-02 + COMMENT-;read current 'us' time into [s3,s2] + ADDRESS-196 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-us_time_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-197 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s4 + OP2 VALUE-s4 + COMMENT-;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + ADDRESS-198 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-s5 + OP2 VALUE-s5 + COMMENT- + ADDRESS-199 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;determine how many 1000us (1ms) units there are (if any) in current 'us' time + ADDRESS-199 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;reset 'ms' counter + ADDRESS-19A + LABEL-test_1000us +INSTRUCTION-SUB + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;subtract 1000 from [s3,s2] + ADDRESS-19B + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-19C + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-store_us_time + OP2 VALUE-19F + COMMENT-;Carry indicates [s3,s2] was less than 1000us + ADDRESS-19D + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + ADDRESS-19E + LABEL- +INSTRUCTION-JUMP + OPERAND1-test_1000us + OP1 VALUE-19A + OPERAND2- + OP2 VALUE- + COMMENT-;repeat to see if more than 1ms has elapsed + ADDRESS-19F + LABEL-store_us_time +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;add 1000 to restore 'us' value + ADDRESS-1A0 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1A1 + LABEL- +INSTRUCTION-STORE + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-us_time_lsb + OP2 VALUE-02 + COMMENT-;store the current value of 'us' + ADDRESS-1A2 + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-us_time_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1A3 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;s0 holds the number of 'ms' elapsed since last update (if any). + ADDRESS-1A3 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT-;read current 'ms' time into [s3,s2] + ADDRESS-1A4 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-1A5 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT-;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + ADDRESS-1A6 + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-1A7 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;determine if there are now more than 1000ms to form 1 second. + ADDRESS-1A7 + LABEL- +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;reset 'second' counter + ADDRESS-1A8 + LABEL- +INSTRUCTION-SUB + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;subtract 1000 from [s3,s2] + ADDRESS-1A9 + LABEL- +INSTRUCTION-SUBCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1AA + LABEL- +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-restore_ms_time + OP2 VALUE-1AD + COMMENT-;Carry indicates [s3,s2] was less than 1000ms + ADDRESS-1AB + LABEL- +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + ADDRESS-1AC + LABEL- +INSTRUCTION-JUMP + OPERAND1-store_ms_time + OP1 VALUE-1AF + OPERAND2- + OP2 VALUE- + COMMENT-;new value of 'ms' is remainder of subtraction + ADDRESS-1AD + LABEL-restore_ms_time +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;add 1000 to restore 'ms' value + ADDRESS-1AE + LABEL- +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1AF + LABEL-store_ms_time +INSTRUCTION-STORE + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT-;store the current value of 'ms' + ADDRESS-1B0 + LABEL- +INSTRUCTION-STORE + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-1B1 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + ADDRESS-1B1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT-;read seconds + ADDRESS-1B2 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT-;add one second if required by s0 + ADDRESS-1B3 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-seconds_in_a_minute + OP2 VALUE-3C + COMMENT-;test for 1 minute + ADDRESS-1B4 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-inc_minutes + OP2 VALUE-1B7 + COMMENT- + ADDRESS-1B5 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT-;store updated seconds + ADDRESS-1B6 + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OP1 VALUE-1C9 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1B7 + LABEL-inc_minutes +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;seconds become zero + ADDRESS-1B8 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT- + ADDRESS-1B9 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT-;read minutes + ADDRESS-1BA + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment minutes + ADDRESS-1BB + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-minutes_in_an_hour + OP2 VALUE-3C + COMMENT-;test for 1 hour + ADDRESS-1BC + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-inc_hours + OP2 VALUE-1BF + COMMENT- + ADDRESS-1BD + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT-;store updated minutes + ADDRESS-1BE + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OP1 VALUE-1C9 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1BF + LABEL-inc_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;minutes become zero + ADDRESS-1C0 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT- + ADDRESS-1C1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;read hours + ADDRESS-1C2 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment hours + ADDRESS-1C3 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-hours_in_a_day + OP2 VALUE-18 + COMMENT-;test for 24 hours + ADDRESS-1C4 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-reset_hours + OP2 VALUE-1C7 + COMMENT- + ADDRESS-1C5 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;store updated hours + ADDRESS-1C6 + LABEL- +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OP1 VALUE-1C9 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1C7 + LABEL-reset_hours +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;hours become zero + ADDRESS-1C8 + LABEL- +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT- + ADDRESS-1C9 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1C9 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;With the time updated, there is then a test for time=alarm time + ADDRESS-1C9 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1C9 + LABEL-time_update_complete +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT- + ADDRESS-1CA + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT-;compare hours + ADDRESS-1CB + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT- + ADDRESS-1CC + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT- + ADDRESS-1CD + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT-;compare minutes + ADDRESS-1CE + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-alarm_time_minutes + OP2 VALUE-0A + COMMENT- + ADDRESS-1CF + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT- + ADDRESS-1D0 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT- + ADDRESS-1D1 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT-;compare seconds + ADDRESS-1D2 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-alarm_time_seconds + OP2 VALUE-0B + COMMENT- + ADDRESS-1D3 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT- + ADDRESS-1D4 + LABEL- +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT- + ADDRESS-1D5 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;test if alarm is turned on + ADDRESS-1D6 + LABEL- +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_armed + OP2 VALUE-02 + COMMENT- + ADDRESS-1D7 + LABEL- +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT-;alarm was off + ADDRESS-1D8 + LABEL- +INSTRUCTION-OR + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_active + OP2 VALUE-01 + COMMENT-;activate alarm + ADDRESS-1D9 + LABEL- +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT- + ADDRESS-1DA + LABEL- +INSTRUCTION-CALL + OPERAND1-alarm_drive + OP1 VALUE-0A4 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1DB + LABEL-finish_update +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-time_preserve0 + OP2 VALUE-10 + COMMENT-;restore the register contents + ADDRESS-1DC + LABEL- +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-time_preserve1 + OP2 VALUE-11 + COMMENT- + ADDRESS-1DD + LABEL- +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-time_preserve2 + OP2 VALUE-12 + COMMENT- + ADDRESS-1DE + LABEL- +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-time_preserve3 + OP2 VALUE-13 + COMMENT- + ADDRESS-1DF + LABEL- +INSTRUCTION-FETCH + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-time_preserve4 + OP2 VALUE-14 + COMMENT- + ADDRESS-1E0 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-time_preserve5 + OP2 VALUE-15 + COMMENT- + ADDRESS-1E1 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert character to upper case + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The character supplied in register s0. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the character is in the range 'a' to 'z', it is converted + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;to the equivalent upper case character in the range 'A' to 'Z'. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;All other characters remain unchanged. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0. + ADDRESS-1E2 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL-upper_case +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-61 + OP2 VALUE-61 + COMMENT-;eliminate character codes below 'a' (61 hex) + ADDRESS-1E3 + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E4 + LABEL- +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-7B + OP2 VALUE-7B + COMMENT-;eliminate character codes above 'z' (7A hex) + ADDRESS-1E5 + LABEL- +INSTRUCTION-RETURN + OPERAND1-NC + OP1 VALUE-NC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E6 + LABEL- +INSTRUCTION-AND + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-DF + OP2 VALUE-DF + COMMENT-;mask bit5 to convert to upper case + ADDRESS-1E7 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert character '0' to '9' to numerical value in range 0 to 9 + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The character supplied in register s0. If the character is in the + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;range '0' to '9', it is converted to the equivalent decimal value. + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Characters not in the range '0' to '9' are signified by the return + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;with the CARRY flag set. + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0. + ADDRESS-1E8 + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL-1char_to_value +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-C6 + OP2 VALUE-C6 + COMMENT-;reject character codes above '9' (39 hex) + ADDRESS-1E9 + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT-;carry flag is set + ADDRESS-1EA + LABEL- +INSTRUCTION-SUB + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-F6 + OP2 VALUE-F6 + COMMENT-;reject character codes below '0' (30 hex) + ADDRESS-1EB + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;carry is set if value not in range + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Determine the numerical value of a two character decimal string held in + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string must be stored as in two consecutive memory locations and the + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;location of the first (tens) character supplied in the s1 register. + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The result is provided in register s2. Strings not using characters in the + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;range '0' to '9' are signified by the return with the CARRY flag set. + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1 and s2. + ADDRESS-1EC + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL-2char_to_value +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;read 'tens' character + ADDRESS-1ED + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OP1 VALUE-1E8 + OPERAND2- + OP2 VALUE- + COMMENT-;convert to numerical value + ADDRESS-1EE + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT-;bad character - CARRY set + ADDRESS-1EF + LABEL- +INSTRUCTION-LOAD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT- + ADDRESS-1F0 + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2- + OP2 VALUE- + COMMENT-;multiply 'tens' value by 10 (0A hex) + ADDRESS-1F1 + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1F2 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT- + ADDRESS-1F3 + LABEL- +INSTRUCTION-SL0 + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1F4 + LABEL- +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;read 'units' character + ADDRESS-1F5 + LABEL- +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT- + ADDRESS-1F6 + LABEL- +INSTRUCTION-CALL + OPERAND1-1char_to_value + OP1 VALUE-1E8 + OPERAND2- + OP2 VALUE- + COMMENT-;convert to numerical value + ADDRESS-1F7 + LABEL- +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT-;bad character - CARRY set + ADDRESS-1F8 + LABEL- +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT-;add units to result and clear CARRY flag + ADDRESS-1F9 + LABEL- +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Interrupt service routine (ISR) + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The interrupt is used to increment a 16-bit counter formed with two registers + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;of micro-seconds elapsed. The counter is 'free running' in that it will count + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;up to 65,535 and then roll over to zero. The count value is then used in other + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;parts of the program as required and where it is less time critical. + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The ISR only uses the specified counter registers + ADDRESS-1FA + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FC + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FC + OP1 VALUE-3FC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FC + LABEL-ISR +INSTRUCTION-ADD + OPERAND1-int_counter_lsb + OP1 VALUE-sD + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;add 1us to 16-bit counter + ADDRESS-3FD + LABEL- +INSTRUCTION-ADDCY + OPERAND1-int_counter_msb + OP1 VALUE-sC + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-3FE + LABEL- +INSTRUCTION-RETURNI + OPERAND1-ENABLE + OP1 VALUE-ENABLE + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Interrupt vector + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION-ADDRESS + OPERAND1-3FF + OP1 VALUE-3FF + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-JUMP + OPERAND1-ISR + OP1 VALUE-3FC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Useful constants + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;ASCII table + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_a + OP1 VALUE-character_a + OPERAND2-61 + OP2 VALUE-61 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_b + OP1 VALUE-character_b + OPERAND2-62 + OP2 VALUE-62 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_c + OP1 VALUE-character_c + OPERAND2-63 + OP2 VALUE-63 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_d + OP1 VALUE-character_d + OPERAND2-64 + OP2 VALUE-64 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_e + OP1 VALUE-character_e + OPERAND2-65 + OP2 VALUE-65 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_f + OP1 VALUE-character_f + OPERAND2-66 + OP2 VALUE-66 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_g + OP1 VALUE-character_g + OPERAND2-67 + OP2 VALUE-67 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_h + OP1 VALUE-character_h + OPERAND2-68 + OP2 VALUE-68 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_i + OP1 VALUE-character_i + OPERAND2-69 + OP2 VALUE-69 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_j + OP1 VALUE-character_j + OPERAND2-6A + OP2 VALUE-6A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_k + OP1 VALUE-character_k + OPERAND2-6B + OP2 VALUE-6B + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_l + OP1 VALUE-character_l + OPERAND2-6C + OP2 VALUE-6C + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_m + OP1 VALUE-character_m + OPERAND2-6D + OP2 VALUE-6D + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_n + OP1 VALUE-character_n + OPERAND2-6E + OP2 VALUE-6E + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_o + OP1 VALUE-character_o + OPERAND2-6F + OP2 VALUE-6F + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_p + OP1 VALUE-character_p + OPERAND2-70 + OP2 VALUE-70 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_q + OP1 VALUE-character_q + OPERAND2-71 + OP2 VALUE-71 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_r + OP1 VALUE-character_r + OPERAND2-72 + OP2 VALUE-72 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_s + OP1 VALUE-character_s + OPERAND2-73 + OP2 VALUE-73 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_t + OP1 VALUE-character_t + OPERAND2-74 + OP2 VALUE-74 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_u + OP1 VALUE-character_u + OPERAND2-75 + OP2 VALUE-75 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_v + OP1 VALUE-character_v + OPERAND2-76 + OP2 VALUE-76 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_w + OP1 VALUE-character_w + OPERAND2-77 + OP2 VALUE-77 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_x + OP1 VALUE-character_x + OPERAND2-78 + OP2 VALUE-78 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_y + OP1 VALUE-character_y + OPERAND2-79 + OP2 VALUE-79 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_z + OP1 VALUE-character_z + OPERAND2-7A + OP2 VALUE-7A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_A + OP1 VALUE-character_A + OPERAND2-41 + OP2 VALUE-41 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_B + OP1 VALUE-character_B + OPERAND2-42 + OP2 VALUE-42 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_C + OP1 VALUE-character_C + OPERAND2-43 + OP2 VALUE-43 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_D + OP1 VALUE-character_D + OPERAND2-44 + OP2 VALUE-44 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_E + OP1 VALUE-character_E + OPERAND2-45 + OP2 VALUE-45 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_F + OP1 VALUE-character_F + OPERAND2-46 + OP2 VALUE-46 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_G + OP1 VALUE-character_G + OPERAND2-47 + OP2 VALUE-47 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_H + OP1 VALUE-character_H + OPERAND2-48 + OP2 VALUE-48 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_I + OP1 VALUE-character_I + OPERAND2-49 + OP2 VALUE-49 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_J + OP1 VALUE-character_J + OPERAND2-4A + OP2 VALUE-4A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_K + OP1 VALUE-character_K + OPERAND2-4B + OP2 VALUE-4B + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_L + OP1 VALUE-character_L + OPERAND2-4C + OP2 VALUE-4C + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_M + OP1 VALUE-character_M + OPERAND2-4D + OP2 VALUE-4D + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_N + OP1 VALUE-character_N + OPERAND2-4E + OP2 VALUE-4E + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_O + OP1 VALUE-character_O + OPERAND2-4F + OP2 VALUE-4F + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_P + OP1 VALUE-character_P + OPERAND2-50 + OP2 VALUE-50 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Q + OP1 VALUE-character_Q + OPERAND2-51 + OP2 VALUE-51 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_R + OP1 VALUE-character_R + OPERAND2-52 + OP2 VALUE-52 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_S + OP1 VALUE-character_S + OPERAND2-53 + OP2 VALUE-53 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_T + OP1 VALUE-character_T + OPERAND2-54 + OP2 VALUE-54 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_U + OP1 VALUE-character_U + OPERAND2-55 + OP2 VALUE-55 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_V + OP1 VALUE-character_V + OPERAND2-56 + OP2 VALUE-56 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_W + OP1 VALUE-character_W + OPERAND2-57 + OP2 VALUE-57 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_X + OP1 VALUE-character_X + OPERAND2-58 + OP2 VALUE-58 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Y + OP1 VALUE-character_Y + OPERAND2-59 + OP2 VALUE-59 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_Z + OP1 VALUE-character_Z + OPERAND2-5A + OP2 VALUE-5A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_0 + OP1 VALUE-character_0 + OPERAND2-30 + OP2 VALUE-30 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_1 + OP1 VALUE-character_1 + OPERAND2-31 + OP2 VALUE-31 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_2 + OP1 VALUE-character_2 + OPERAND2-32 + OP2 VALUE-32 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_3 + OP1 VALUE-character_3 + OPERAND2-33 + OP2 VALUE-33 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_4 + OP1 VALUE-character_4 + OPERAND2-34 + OP2 VALUE-34 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_5 + OP1 VALUE-character_5 + OPERAND2-35 + OP2 VALUE-35 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_6 + OP1 VALUE-character_6 + OPERAND2-36 + OP2 VALUE-36 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_7 + OP1 VALUE-character_7 + OPERAND2-37 + OP2 VALUE-37 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_8 + OP1 VALUE-character_8 + OPERAND2-38 + OP2 VALUE-38 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_9 + OP1 VALUE-character_9 + OPERAND2-39 + OP2 VALUE-39 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_colon + OP1 VALUE-character_colon + OPERAND2-3A + OP2 VALUE-3A + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_semi_colon + OP1 VALUE-character_semi_colon + OPERAND2-3B + OP2 VALUE-3B + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_less_than + OP1 VALUE-character_less_than + OPERAND2-3C + OP2 VALUE-3C + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_greater_than + OP1 VALUE-character_greater_than + OPERAND2-3E + OP2 VALUE-3E + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_equals + OP1 VALUE-character_equals + OPERAND2-3D + OP2 VALUE-3D + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_space + OP1 VALUE-character_space + OPERAND2-20 + OP2 VALUE-20 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_CR + OP1 VALUE-character_CR + OPERAND2-0D + OP2 VALUE-0D + COMMENT-;carriage return + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_question + OP1 VALUE-character_question + OPERAND2-3F + OP2 VALUE-3F + COMMENT-;'?' + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_dollar + OP1 VALUE-character_dollar + OPERAND2-24 + OP2 VALUE-24 + COMMENT- + ADDRESS-3FF + LABEL- +INSTRUCTION-CONSTANT + OPERAND1-character_BS + OP1 VALUE-character_BS + OPERAND2-08 + OP2 VALUE-08 + COMMENT-;Back Space command character + ADDRESS-3FF + LABEL- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; diff --git a/projects/PicoBlaze/ise/Assembler/PASS5.DAT b/projects/PicoBlaze/ise/Assembler/PASS5.DAT new file mode 100644 index 0000000..00045d7 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/PASS5.DAT @@ -0,0 +1,10080 @@ + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;KCPSM3 Program - Real Time Clock with UART communication. + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Ken Chapman - Xilinx Ltd - October 2003 + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Port definitions + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT UART_status_port, 00 + LOGFORMAT-CONSTANT UART_status_port, 00 +INSTRUCTION-CONSTANT + OPERAND1-UART_status_port + OP1 VALUE-UART_status_port + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;UART status input + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT tx_half_full, 01 + LOGFORMAT-CONSTANT tx_half_full, 01 +INSTRUCTION-CONSTANT + OPERAND1-tx_half_full + OP1 VALUE-tx_half_full + OPERAND2-01 + OP2 VALUE-01 + COMMENT-; Transmitter half full - bit0 + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT tx_full, 02 + LOGFORMAT-CONSTANT tx_full, 02 +INSTRUCTION-CONSTANT + OPERAND1-tx_full + OP1 VALUE-tx_full + OPERAND2-02 + OP2 VALUE-02 + COMMENT-; FIFO full - bit1 + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT rx_half_full, 04 + LOGFORMAT-CONSTANT rx_half_full, 04 +INSTRUCTION-CONSTANT + OPERAND1-rx_half_full + OP1 VALUE-rx_half_full + OPERAND2-04 + OP2 VALUE-04 + COMMENT-; Receiver half full - bit2 + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT rx_full, 08 + LOGFORMAT-CONSTANT rx_full, 08 +INSTRUCTION-CONSTANT + OPERAND1-rx_full + OP1 VALUE-rx_full + OPERAND2-08 + OP2 VALUE-08 + COMMENT-; FIFO full - bit3 + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT rx_data_present, 10 + LOGFORMAT-CONSTANT rx_data_present, 10 +INSTRUCTION-CONSTANT + OPERAND1-rx_data_present + OP1 VALUE-rx_data_present + OPERAND2-10 + OP2 VALUE-10 + COMMENT-; data present - bit4 + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT UART_read_port, 01 + LOGFORMAT-CONSTANT UART_read_port, 01 +INSTRUCTION-CONSTANT + OPERAND1-UART_read_port + OP1 VALUE-UART_read_port + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;UART Rx data input + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT UART_write_port, 01 + LOGFORMAT-CONSTANT UART_write_port, 01 +INSTRUCTION-CONSTANT + OPERAND1-UART_write_port + OP1 VALUE-UART_write_port + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;UART Tx data output + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_port, 00 + LOGFORMAT-CONSTANT alarm_port, 00 +INSTRUCTION-CONSTANT + OPERAND1-alarm_port + OP1 VALUE-alarm_port + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;Alarm output + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_control, 01 + LOGFORMAT-CONSTANT alarm_control, 01 +INSTRUCTION-CONSTANT + OPERAND1-alarm_control + OP1 VALUE-alarm_control + OPERAND2-01 + OP2 VALUE-01 + COMMENT-; bit0 + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Special Register usage + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-NAMEREG sF, UART_data + LOGFORMAT-NAMEREG sF, UART_data +INSTRUCTION-NAMEREG + OPERAND1-sF + OP1 VALUE-sF + OPERAND2-UART_data + OP2 VALUE-UART_data + COMMENT-;used to pass data to and from the UART + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-NAMEREG sE, store_pointer + LOGFORMAT-NAMEREG sE, store_pointer +INSTRUCTION-NAMEREG + OPERAND1-sE + OP1 VALUE-sE + OPERAND2-store_pointer + OP2 VALUE-store_pointer + COMMENT-;used to pass location of data in scratch pad memory + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Two registers to form a 16-bit counter used to count + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;interrupt pulses generated at 1us intervals. + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-NAMEREG sD, int_counter_lsb + LOGFORMAT-NAMEREG sD, int_counter_lsb +INSTRUCTION-NAMEREG + OPERAND1-sD + OP1 VALUE-sD + OPERAND2-int_counter_lsb + OP2 VALUE-int_counter_lsb + COMMENT-;lower 8-bits + ADDRESS-000 + LABEL- + FORMATTED-NAMEREG sC, int_counter_msb + LOGFORMAT-NAMEREG sC, int_counter_msb +INSTRUCTION-NAMEREG + OPERAND1-sC + OP1 VALUE-sC + OPERAND2-int_counter_msb + OP2 VALUE-int_counter_msb + COMMENT-;upper 8-bits + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Scratch Pad Memory Locations + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT us_time_stamp_lsb, 00 + LOGFORMAT-CONSTANT us_time_stamp_lsb, 00 +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_lsb + OP1 VALUE-us_time_stamp_lsb + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;16-bit micro-second time stamp + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT us_time_stamp_msb, 01 + LOGFORMAT-CONSTANT us_time_stamp_msb, 01 +INSTRUCTION-CONSTANT + OPERAND1-us_time_stamp_msb + OP1 VALUE-us_time_stamp_msb + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT us_time_lsb, 02 + LOGFORMAT-CONSTANT us_time_lsb, 02 +INSTRUCTION-CONSTANT + OPERAND1-us_time_lsb + OP1 VALUE-us_time_lsb + OPERAND2-02 + OP2 VALUE-02 + COMMENT-;16-bit micro-second real time value + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT us_time_msb, 03 + LOGFORMAT-CONSTANT us_time_msb, 03 +INSTRUCTION-CONSTANT + OPERAND1-us_time_msb + OP1 VALUE-us_time_msb + OPERAND2-03 + OP2 VALUE-03 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT ms_time_lsb, 04 + LOGFORMAT-CONSTANT ms_time_lsb, 04 +INSTRUCTION-CONSTANT + OPERAND1-ms_time_lsb + OP1 VALUE-ms_time_lsb + OPERAND2-04 + OP2 VALUE-04 + COMMENT-;16-bit milli-second real time value + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT ms_time_msb, 05 + LOGFORMAT-CONSTANT ms_time_msb, 05 +INSTRUCTION-CONSTANT + OPERAND1-ms_time_msb + OP1 VALUE-ms_time_msb + OPERAND2-05 + OP2 VALUE-05 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT real_time_hours, 06 + LOGFORMAT-CONSTANT real_time_hours, 06 +INSTRUCTION-CONSTANT + OPERAND1-real_time_hours + OP1 VALUE-real_time_hours + OPERAND2-06 + OP2 VALUE-06 + COMMENT-;Current clock time + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT real_time_minutes, 07 + LOGFORMAT-CONSTANT real_time_minutes, 07 +INSTRUCTION-CONSTANT + OPERAND1-real_time_minutes + OP1 VALUE-real_time_minutes + OPERAND2-07 + OP2 VALUE-07 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT real_time_seconds, 08 + LOGFORMAT-CONSTANT real_time_seconds, 08 +INSTRUCTION-CONSTANT + OPERAND1-real_time_seconds + OP1 VALUE-real_time_seconds + OPERAND2-08 + OP2 VALUE-08 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_time_hours, 09 + LOGFORMAT-CONSTANT alarm_time_hours, 09 +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_hours + OP1 VALUE-alarm_time_hours + OPERAND2-09 + OP2 VALUE-09 + COMMENT-;Alarm time + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_time_minutes, 0A + LOGFORMAT-CONSTANT alarm_time_minutes, 0A +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_minutes + OP1 VALUE-alarm_time_minutes + OPERAND2-0A + OP2 VALUE-0A + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_time_seconds, 0B + LOGFORMAT-CONSTANT alarm_time_seconds, 0B +INSTRUCTION-CONSTANT + OPERAND1-alarm_time_seconds + OP1 VALUE-alarm_time_seconds + OPERAND2-0B + OP2 VALUE-0B + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_status, 0C + LOGFORMAT-CONSTANT alarm_status, 0C +INSTRUCTION-CONSTANT + OPERAND1-alarm_status + OP1 VALUE-alarm_status + OPERAND2-0C + OP2 VALUE-0C + COMMENT-;Alarm status + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_active, 01 + LOGFORMAT-CONSTANT alarm_active, 01 +INSTRUCTION-CONSTANT + OPERAND1-alarm_active + OP1 VALUE-alarm_active + OPERAND2-01 + OP2 VALUE-01 + COMMENT-; bit0 - Alarm is active + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT alarm_armed, 02 + LOGFORMAT-CONSTANT alarm_armed, 02 +INSTRUCTION-CONSTANT + OPERAND1-alarm_armed + OP1 VALUE-alarm_armed + OPERAND2-02 + OP2 VALUE-02 + COMMENT-; bit1 - Alarm is armed + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT time_preserve0, 10 + LOGFORMAT-CONSTANT time_preserve0, 10 +INSTRUCTION-CONSTANT + OPERAND1-time_preserve0 + OP1 VALUE-time_preserve0 + OPERAND2-10 + OP2 VALUE-10 + COMMENT-;storage for protection of registers + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT time_preserve1, 11 + LOGFORMAT-CONSTANT time_preserve1, 11 +INSTRUCTION-CONSTANT + OPERAND1-time_preserve1 + OP1 VALUE-time_preserve1 + OPERAND2-11 + OP2 VALUE-11 + COMMENT-;used by the real time clock routine. + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT time_preserve2, 12 + LOGFORMAT-CONSTANT time_preserve2, 12 +INSTRUCTION-CONSTANT + OPERAND1-time_preserve2 + OP1 VALUE-time_preserve2 + OPERAND2-12 + OP2 VALUE-12 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT time_preserve3, 13 + LOGFORMAT-CONSTANT time_preserve3, 13 +INSTRUCTION-CONSTANT + OPERAND1-time_preserve3 + OP1 VALUE-time_preserve3 + OPERAND2-13 + OP2 VALUE-13 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT time_preserve4, 14 + LOGFORMAT-CONSTANT time_preserve4, 14 +INSTRUCTION-CONSTANT + OPERAND1-time_preserve4 + OP1 VALUE-time_preserve4 + OPERAND2-14 + OP2 VALUE-14 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT time_preserve5, 15 + LOGFORMAT-CONSTANT time_preserve5, 15 +INSTRUCTION-CONSTANT + OPERAND1-time_preserve5 + OP1 VALUE-time_preserve5 + OPERAND2-15 + OP2 VALUE-15 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;UART character strings will be stored in scratch pad memory ending in carriage return. + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A string can be up to 16 characters with the start location defined by this constant. + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED-CONSTANT string_start, 20 + LOGFORMAT-CONSTANT string_start, 20 +INSTRUCTION-CONSTANT + OPERAND1-string_start + OP1 VALUE-string_start + OPERAND2-20 + OP2 VALUE-20 + COMMENT- + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Initialise the system + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-000 + LABEL-cold_start + FORMATTED-LOAD s0, 00 + LOGFORMAT-LOAD s0, 00 +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;clear all time values + ADDRESS-001 + LABEL- + FORMATTED-STORE s0, us_time_stamp_lsb + LOGFORMAT-STORE s0, us_time_stamp_lsb[00] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT- + ADDRESS-002 + LABEL- + FORMATTED-STORE s0, us_time_stamp_msb + LOGFORMAT-STORE s0, us_time_stamp_msb[01] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT- + ADDRESS-003 + LABEL- + FORMATTED-STORE s0, us_time_lsb + LOGFORMAT-STORE s0, us_time_lsb[02] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_lsb + OP2 VALUE-02 + COMMENT- + ADDRESS-004 + LABEL- + FORMATTED-STORE s0, us_time_msb + LOGFORMAT-STORE s0, us_time_msb[03] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-us_time_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-005 + LABEL- + FORMATTED-STORE s0, ms_time_lsb + LOGFORMAT-STORE s0, ms_time_lsb[04] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT- + ADDRESS-006 + LABEL- + FORMATTED-STORE s0, ms_time_msb + LOGFORMAT-STORE s0, ms_time_msb[05] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-007 + LABEL- + FORMATTED-STORE s0, real_time_hours + LOGFORMAT-STORE s0, real_time_hours[06] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT- + ADDRESS-008 + LABEL- + FORMATTED-STORE s0, real_time_minutes + LOGFORMAT-STORE s0, real_time_minutes[07] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT- + ADDRESS-009 + LABEL- + FORMATTED-STORE s0, real_time_seconds + LOGFORMAT-STORE s0, real_time_seconds[08] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT- + ADDRESS-00A + LABEL- + FORMATTED-STORE s0, alarm_time_hours + LOGFORMAT-STORE s0, alarm_time_hours[09] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT- + ADDRESS-00B + LABEL- + FORMATTED-STORE s0, alarm_time_minutes + LOGFORMAT-STORE s0, alarm_time_minutes[0A] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_time_minutes + OP2 VALUE-0A + COMMENT- + ADDRESS-00C + LABEL- + FORMATTED-STORE s0, alarm_time_seconds + LOGFORMAT-STORE s0, alarm_time_seconds[0B] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_time_seconds + OP2 VALUE-0B + COMMENT- + ADDRESS-00D + LABEL- + FORMATTED-STORE s0, alarm_status + LOGFORMAT-STORE s0, alarm_status[0C] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;clear and disable alarm + ADDRESS-00E + LABEL- + FORMATTED-CALL alarm_drive + LOGFORMAT-CALL alarm_drive[0A4] +INSTRUCTION-CALL + OPERAND1-alarm_drive + OP1 VALUE-0A4 + OPERAND2- + OP2 VALUE- + COMMENT-;turn off alarm control output port + ADDRESS-00F + LABEL- + FORMATTED-LOAD int_counter_lsb, 00 + LOGFORMAT-LOAD int_counter_lsb[sD], 00 +INSTRUCTION-LOAD + OPERAND1-int_counter_lsb + OP1 VALUE-sD + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;clear 'us' interrupt counter + ADDRESS-010 + LABEL- + FORMATTED-LOAD int_counter_msb, 00 + LOGFORMAT-LOAD int_counter_msb[sC], 00 +INSTRUCTION-LOAD + OPERAND1-int_counter_msb + OP1 VALUE-sC + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-011 + LABEL- + FORMATTED-ENABLE INTERRUPT + LOGFORMAT-ENABLE INTERRUPT +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OP1 VALUE-INTERRUPT + OPERAND2- + OP2 VALUE- + COMMENT-;enable the 1us interrupts + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Start of the main program loop. + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A prompt is transmitted to the UART transmitter and then + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;a command can be entered and interpreted. + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-012 + LABEL-prompt_input + FORMATTED-CALL send_prompt + LOGFORMAT-CALL send_prompt[115] +INSTRUCTION-CALL + OPERAND1-send_prompt + OP1 VALUE-115 + OPERAND2- + OP2 VALUE- + COMMENT-;Prompt 'KCPSM3>' + ADDRESS-013 + LABEL- + FORMATTED-CALL receive_string + LOGFORMAT-CALL receive_string[0C3] +INSTRUCTION-CALL + OPERAND1-receive_string + OP1 VALUE-0C3 + OPERAND2- + OP2 VALUE- + COMMENT-;obtain input string and maintain the time + ADDRESS-014 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Parse the string and perform actions as required + ADDRESS-014 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-014 + LABEL- + FORMATTED-LOAD s1, string_start + LOGFORMAT-LOAD s1, string_start[20] +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT- + ADDRESS-015 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-016 + LABEL- + FORMATTED-COMPARE s0, character_CR + LOGFORMAT-COMPARE s0, character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;carriage return does nothing + ADDRESS-017 + LABEL- + FORMATTED-JUMP Z, prompt_input + LOGFORMAT-JUMP Z, prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT- + ADDRESS-018 + LABEL- + FORMATTED-COMPARE s0, character_T + LOGFORMAT-COMPARE s0, character_T[54] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_T + OP2 VALUE-54 + COMMENT-;start of 'TIME' command? + ADDRESS-019 + LABEL- + FORMATTED-JUMP Z, test_for_TIME + LOGFORMAT-JUMP Z, test_for_TIME[01E] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-test_for_TIME + OP2 VALUE-01E + COMMENT- + ADDRESS-01A + LABEL- + FORMATTED-COMPARE s0, character_A + LOGFORMAT-COMPARE s0, character_A[41] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_A + OP2 VALUE-41 + COMMENT-;start of 'ALARM' command? + ADDRESS-01B + LABEL- + FORMATTED-JUMP Z, test_for_ALARM + LOGFORMAT-JUMP Z, test_for_ALARM[037] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-test_for_ALARM + OP2 VALUE-037 + COMMENT- + ADDRESS-01C + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01C + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;trap other command starts here + ADDRESS-01C + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01C + LABEL-bad_input_command + FORMATTED-CALL send_Syntax_Error + LOGFORMAT-CALL send_Syntax_Error[0ED] +INSTRUCTION-CALL + OPERAND1-send_Syntax_Error + OP1 VALUE-0ED + OPERAND2- + OP2 VALUE- + COMMENT-;no valid command + ADDRESS-01D + LABEL- + FORMATTED-JUMP Z, prompt_input + LOGFORMAT-JUMP Z, prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT- + ADDRESS-01E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-01E + LABEL-test_for_TIME + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-01F + LABEL- + FORMATTED-COMPARE s0, character_I + LOGFORMAT-COMPARE s0, character_I[49] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_I + OP2 VALUE-49 + COMMENT-;test for rest of 'TIME' + ADDRESS-020 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-021 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-022 + LABEL- + FORMATTED-COMPARE s0, character_M + LOGFORMAT-COMPARE s0, character_M[4D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_M + OP2 VALUE-4D + COMMENT- + ADDRESS-023 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-024 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-025 + LABEL- + FORMATTED-COMPARE s0, character_E + LOGFORMAT-COMPARE s0, character_E[45] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_E + OP2 VALUE-45 + COMMENT- + ADDRESS-026 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-027 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;now have a valid TIME command to process + ADDRESS-027 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-028 + LABEL- + FORMATTED-COMPARE s0, character_CR + LOGFORMAT-COMPARE s0, character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;carriage return means display time + ADDRESS-029 + LABEL- + FORMATTED-JUMP NZ, set_time_command + LOGFORMAT-JUMP NZ, set_time_command[02C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-set_time_command + OP2 VALUE-02C + COMMENT- + ADDRESS-02A + LABEL- + FORMATTED-CALL transmit_time + LOGFORMAT-CALL transmit_time[0A8] +INSTRUCTION-CALL + OPERAND1-transmit_time + OP1 VALUE-0A8 + OPERAND2- + OP2 VALUE- + COMMENT-;transmit time to UART + ADDRESS-02B + LABEL- + FORMATTED-JUMP prompt_input + LOGFORMAT-JUMP prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-02C + LABEL-set_time_command + FORMATTED-COMPARE s0, character_space + LOGFORMAT-COMPARE s0, character_space[20] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_space + OP2 VALUE-20 + COMMENT- + ADDRESS-02D + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-02E + LABEL- + FORMATTED-CALL test_time_string + LOGFORMAT-CALL test_time_string[06D] +INSTRUCTION-CALL + OPERAND1-test_time_string + OP1 VALUE-06D + OPERAND2- + OP2 VALUE- + COMMENT-;interpret 'hh:mm:ss' string + ADDRESS-02F + LABEL- + FORMATTED-JUMP C, prompt_input + LOGFORMAT-JUMP C, prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT-;test for invalid input + ADDRESS-030 + LABEL- + FORMATTED-STORE s6, real_time_hours + LOGFORMAT-STORE s6, real_time_hours[06] +INSTRUCTION-STORE + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;set new time into clock + ADDRESS-031 + LABEL- + FORMATTED-STORE s5, real_time_minutes + LOGFORMAT-STORE s5, real_time_minutes[07] +INSTRUCTION-STORE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT- + ADDRESS-032 + LABEL- + FORMATTED-STORE s4, real_time_seconds + LOGFORMAT-STORE s4, real_time_seconds[08] +INSTRUCTION-STORE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT- + ADDRESS-033 + LABEL- + FORMATTED-STORE s0, ms_time_lsb + LOGFORMAT-STORE s0, ms_time_lsb[04] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT-;clear 'ms' counter (s0=00) + ADDRESS-034 + LABEL- + FORMATTED-STORE s0, ms_time_msb + LOGFORMAT-STORE s0, ms_time_msb[05] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-035 + LABEL- + FORMATTED-CALL transmit_time + LOGFORMAT-CALL transmit_time[0A8] +INSTRUCTION-CALL + OPERAND1-transmit_time + OP1 VALUE-0A8 + OPERAND2- + OP2 VALUE- + COMMENT-;transmit new time to UART + ADDRESS-036 + LABEL- + FORMATTED-JUMP prompt_input + LOGFORMAT-JUMP prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-037 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-037 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-037 + LABEL-test_for_ALARM + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-038 + LABEL- + FORMATTED-COMPARE s0, character_L + LOGFORMAT-COMPARE s0, character_L[4C] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_L + OP2 VALUE-4C + COMMENT-;test for rest of 'ALARM' + ADDRESS-039 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-03A + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-03B + LABEL- + FORMATTED-COMPARE s0, character_A + LOGFORMAT-COMPARE s0, character_A[41] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_A + OP2 VALUE-41 + COMMENT- + ADDRESS-03C + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-03D + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-03E + LABEL- + FORMATTED-COMPARE s0, character_R + LOGFORMAT-COMPARE s0, character_R[52] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_R + OP2 VALUE-52 + COMMENT- + ADDRESS-03F + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-040 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-041 + LABEL- + FORMATTED-COMPARE s0, character_M + LOGFORMAT-COMPARE s0, character_M[4D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_M + OP2 VALUE-4D + COMMENT- + ADDRESS-042 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-043 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;now have a valid ALARM command to process + ADDRESS-043 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-044 + LABEL- + FORMATTED-COMPARE s0, character_CR + LOGFORMAT-COMPARE s0, character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;carriage return means display alarm time + ADDRESS-045 + LABEL- + FORMATTED-JUMP NZ, set_alarm_command + LOGFORMAT-JUMP NZ, set_alarm_command[048] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-set_alarm_command + OP2 VALUE-048 + COMMENT- + ADDRESS-046 + LABEL- + FORMATTED-CALL transmit_alarm_time + LOGFORMAT-CALL transmit_alarm_time[0AC] +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit time to UART + ADDRESS-047 + LABEL- + FORMATTED-JUMP prompt_input + LOGFORMAT-JUMP prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-048 + LABEL-set_alarm_command + FORMATTED-COMPARE s0, character_space + LOGFORMAT-COMPARE s0, character_space[20] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_space + OP2 VALUE-20 + COMMENT-;test for ON or OFF command + ADDRESS-049 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-04A + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-04B + LABEL- + FORMATTED-COMPARE s0, character_O + LOGFORMAT-COMPARE s0, character_O[4F] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-04C + LABEL- + FORMATTED-JUMP Z, set_alarm_on_off + LOGFORMAT-JUMP Z, set_alarm_on_off[055] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-set_alarm_on_off + OP2 VALUE-055 + COMMENT- + ADDRESS-04D + LABEL- + FORMATTED-SUB s1, 01 + LOGFORMAT-SUB s1, 01 +INSTRUCTION-SUB + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move memory pointer back to first character of 'hh:mm:ss' string + ADDRESS-04E + LABEL- + FORMATTED-CALL test_time_string + LOGFORMAT-CALL test_time_string[06D] +INSTRUCTION-CALL + OPERAND1-test_time_string + OP1 VALUE-06D + OPERAND2- + OP2 VALUE- + COMMENT-;interpret 'hh:mm:ss' string + ADDRESS-04F + LABEL- + FORMATTED-JUMP C, prompt_input + LOGFORMAT-JUMP C, prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-prompt_input + OP2 VALUE-012 + COMMENT-;test for invalid input + ADDRESS-050 + LABEL- + FORMATTED-STORE s6, alarm_time_hours + LOGFORMAT-STORE s6, alarm_time_hours[09] +INSTRUCTION-STORE + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT-;set new time into clock + ADDRESS-051 + LABEL- + FORMATTED-STORE s5, alarm_time_minutes + LOGFORMAT-STORE s5, alarm_time_minutes[0A] +INSTRUCTION-STORE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-alarm_time_minutes + OP2 VALUE-0A + COMMENT- + ADDRESS-052 + LABEL- + FORMATTED-STORE s4, alarm_time_seconds + LOGFORMAT-STORE s4, alarm_time_seconds[0B] +INSTRUCTION-STORE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-alarm_time_seconds + OP2 VALUE-0B + COMMENT- + ADDRESS-053 + LABEL- + FORMATTED-CALL transmit_alarm_time + LOGFORMAT-CALL transmit_alarm_time[0AC] +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit new alarm time and status + ADDRESS-054 + LABEL- + FORMATTED-JUMP prompt_input + LOGFORMAT-JUMP prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-055 + LABEL-set_alarm_on_off + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-056 + LABEL- + FORMATTED-COMPARE s0, character_N + LOGFORMAT-COMPARE s0, character_N[4E] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_N + OP2 VALUE-4E + COMMENT-;test for 'ON' + ADDRESS-057 + LABEL- + FORMATTED-JUMP NZ, test_OFF + LOGFORMAT-JUMP NZ, test_OFF[060] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-test_OFF + OP2 VALUE-060 + COMMENT- + ADDRESS-058 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-059 + LABEL- + FORMATTED-COMPARE s0, character_CR + LOGFORMAT-COMPARE s0, character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT- + ADDRESS-05A + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-05B + LABEL- + FORMATTED-FETCH s0, alarm_status + LOGFORMAT-FETCH s0, alarm_status[0C] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;turn alarm on + ADDRESS-05C + LABEL- + FORMATTED-OR s0, alarm_armed + LOGFORMAT-OR s0, alarm_armed[02] +INSTRUCTION-OR + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_armed + OP2 VALUE-02 + COMMENT- + ADDRESS-05D + LABEL- + FORMATTED-STORE s0, alarm_status + LOGFORMAT-STORE s0, alarm_status[0C] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT- + ADDRESS-05E + LABEL- + FORMATTED-CALL transmit_alarm_time + LOGFORMAT-CALL transmit_alarm_time[0AC] +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit alarm time and status + ADDRESS-05F + LABEL- + FORMATTED-JUMP prompt_input + LOGFORMAT-JUMP prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-060 + LABEL-test_OFF + FORMATTED-COMPARE s0, character_F + LOGFORMAT-COMPARE s0, character_F[46] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_F + OP2 VALUE-46 + COMMENT-;test for for 'OFF' + ADDRESS-061 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-062 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-063 + LABEL- + FORMATTED-COMPARE s0, character_F + LOGFORMAT-COMPARE s0, character_F[46] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_F + OP2 VALUE-46 + COMMENT- + ADDRESS-064 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-065 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-066 + LABEL- + FORMATTED-COMPARE s0, character_CR + LOGFORMAT-COMPARE s0, character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT- + ADDRESS-067 + LABEL- + FORMATTED-JUMP NZ, bad_input_command + LOGFORMAT-JUMP NZ, bad_input_command[01C] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-bad_input_command + OP2 VALUE-01C + COMMENT- + ADDRESS-068 + LABEL- + FORMATTED-LOAD s0, 00 + LOGFORMAT-LOAD s0, 00 +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;turn alarm off and stop an active alarm + ADDRESS-069 + LABEL- + FORMATTED-STORE s0, alarm_status + LOGFORMAT-STORE s0, alarm_status[0C] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT- + ADDRESS-06A + LABEL- + FORMATTED-CALL alarm_drive + LOGFORMAT-CALL alarm_drive[0A4] +INSTRUCTION-CALL + OPERAND1-alarm_drive + OP1 VALUE-0A4 + OPERAND2- + OP2 VALUE- + COMMENT-;turn off alarm + ADDRESS-06B + LABEL- + FORMATTED-CALL transmit_alarm_time + LOGFORMAT-CALL transmit_alarm_time[0AC] +INSTRUCTION-CALL + OPERAND1-transmit_alarm_time + OP1 VALUE-0AC + OPERAND2- + OP2 VALUE- + COMMENT-;transmit alarm time and status + ADDRESS-06C + LABEL- + FORMATTED-JUMP prompt_input + LOGFORMAT-JUMP prompt_input[012] +INSTRUCTION-JUMP + OPERAND1-prompt_input + OP1 VALUE-012 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Read an 'hh:mm:ss' time string and provide new values. + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string must be provided in successive scratch pad memory locations + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;with the s1 register containing the location of the first character. + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A correct time specification will result in the return of new values + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;as follows:- + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s6 = hours + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s5 = minutes + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s4 = seconds + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the syntax is incorrect or values are not in the correct ranges an + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;'Invalid Time' message will be transmitted and the CARRY flag will be set + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s6, s5 and s4 + ADDRESS-06D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-06D + LABEL-test_time_string + FORMATTED-CALL 2char_to_value + LOGFORMAT-CALL 2char_to_value[1EC] +INSTRUCTION-CALL + OPERAND1-2char_to_value + OP1 VALUE-1EC + OPERAND2- + OP2 VALUE- + COMMENT-;obtain hours value + ADDRESS-06E + LABEL- + FORMATTED-JUMP C, invalid_time + LOGFORMAT-JUMP C, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT-;test for non-decimal characters + ADDRESS-06F + LABEL- + FORMATTED-LOAD s6, s2 + LOGFORMAT-LOAD s6, s2 +INSTRUCTION-LOAD + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;remember hours + ADDRESS-070 + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer past hours + ADDRESS-071 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-072 + LABEL- + FORMATTED-COMPARE s0, character_colon + LOGFORMAT-COMPARE s0, character_colon[3A] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;test for colon + ADDRESS-073 + LABEL- + FORMATTED-JUMP NZ, invalid_time + LOGFORMAT-JUMP NZ, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-074 + LABEL- + FORMATTED-CALL 2char_to_value + LOGFORMAT-CALL 2char_to_value[1EC] +INSTRUCTION-CALL + OPERAND1-2char_to_value + OP1 VALUE-1EC + OPERAND2- + OP2 VALUE- + COMMENT-;obtain minutes value + ADDRESS-075 + LABEL- + FORMATTED-JUMP C, invalid_time + LOGFORMAT-JUMP C, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT-;test for non-decimal characters + ADDRESS-076 + LABEL- + FORMATTED-LOAD s5, s2 + LOGFORMAT-LOAD s5, s2 +INSTRUCTION-LOAD + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;remember minutes + ADDRESS-077 + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer past minutes + ADDRESS-078 + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-079 + LABEL- + FORMATTED-COMPARE s0, character_colon + LOGFORMAT-COMPARE s0, character_colon[3A] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;test for colon + ADDRESS-07A + LABEL- + FORMATTED-JUMP NZ, invalid_time + LOGFORMAT-JUMP NZ, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-07B + LABEL- + FORMATTED-CALL 2char_to_value + LOGFORMAT-CALL 2char_to_value[1EC] +INSTRUCTION-CALL + OPERAND1-2char_to_value + OP1 VALUE-1EC + OPERAND2- + OP2 VALUE- + COMMENT-;obtain seconds value + ADDRESS-07C + LABEL- + FORMATTED-JUMP C, invalid_time + LOGFORMAT-JUMP C, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT-;test for non-decimal characters + ADDRESS-07D + LABEL- + FORMATTED-LOAD s4, s2 + LOGFORMAT-LOAD s4, s2 +INSTRUCTION-LOAD + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;remember minutes + ADDRESS-07E + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer past seconds + ADDRESS-07F + LABEL- + FORMATTED-CALL fetch_char_from_memory + LOGFORMAT-CALL fetch_char_from_memory[091] +INSTRUCTION-CALL + OPERAND1-fetch_char_from_memory + OP1 VALUE-091 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-080 + LABEL- + FORMATTED-COMPARE s0, character_CR + LOGFORMAT-COMPARE s0, character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;finish with carriage return + ADDRESS-081 + LABEL- + FORMATTED-JUMP NZ, invalid_time + LOGFORMAT-JUMP NZ, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-082 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Have values for hh:mm:ss but need to test if each is valid range. + ADDRESS-082 + LABEL- + FORMATTED-COMPARE s6, hours_in_a_day + LOGFORMAT-COMPARE s6, hours_in_a_day[18] +INSTRUCTION-COMPARE + OPERAND1-s6 + OP1 VALUE-s6 + OPERAND2-hours_in_a_day + OP2 VALUE-18 + COMMENT- + ADDRESS-083 + LABEL- + FORMATTED-JUMP NC, invalid_time + LOGFORMAT-JUMP NC, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-084 + LABEL- + FORMATTED-COMPARE s5, minutes_in_an_hour + LOGFORMAT-COMPARE s5, minutes_in_an_hour[3C] +INSTRUCTION-COMPARE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-minutes_in_an_hour + OP2 VALUE-3C + COMMENT- + ADDRESS-085 + LABEL- + FORMATTED-JUMP NC, invalid_time + LOGFORMAT-JUMP NC, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-086 + LABEL- + FORMATTED-COMPARE s4, seconds_in_a_minute + LOGFORMAT-COMPARE s4, seconds_in_a_minute[3C] +INSTRUCTION-COMPARE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-seconds_in_a_minute + OP2 VALUE-3C + COMMENT- + ADDRESS-087 + LABEL- + FORMATTED-JUMP NC, invalid_time + LOGFORMAT-JUMP NC, invalid_time[08B] +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-invalid_time + OP2 VALUE-08B + COMMENT- + ADDRESS-088 + LABEL- + FORMATTED-LOAD s0, 00 + LOGFORMAT-LOAD s0, 00 +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-089 + LABEL- + FORMATTED-SR0 s0 + LOGFORMAT-SR0 s0 +INSTRUCTION-SR0 + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2- + OP2 VALUE- + COMMENT-;reset CARRY flag (with s0=0) + ADDRESS-08A + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;time string was OK + ADDRESS-08B + LABEL-invalid_time + FORMATTED-CALL send_Invalid + LOGFORMAT-CALL send_Invalid[125] +INSTRUCTION-CALL + OPERAND1-send_Invalid + OP1 VALUE-125 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-08C + LABEL- + FORMATTED-CALL send_space + LOGFORMAT-CALL send_space[0E7] +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-08D + LABEL- + FORMATTED-CALL send_Time + LOGFORMAT-CALL send_Time[134] +INSTRUCTION-CALL + OPERAND1-send_Time + OP1 VALUE-134 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-08E + LABEL- + FORMATTED-LOAD s0, 01 + LOGFORMAT-LOAD s0, 01 +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-08F + LABEL- + FORMATTED-SR0 s0 + LOGFORMAT-SR0 s0 +INSTRUCTION-SR0 + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2- + OP2 VALUE- + COMMENT-;set CARRY flag + ADDRESS-090 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;time string was bad + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Fetch character from memory, convert to upper case + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;and increment memory pointer. + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The memory pointer is provided in register s1. + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The character obtained is returned in register s0. + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 and s1. + ADDRESS-091 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-091 + LABEL-fetch_char_from_memory + FORMATTED-FETCH s0, (s1) + LOGFORMAT-FETCH s0, (s1) +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;read character + ADDRESS-092 + LABEL- + FORMATTED-CALL upper_case + LOGFORMAT-CALL upper_case[1E2] +INSTRUCTION-CALL + OPERAND1-upper_case + OP1 VALUE-1E2 + OPERAND2- + OP2 VALUE- + COMMENT-;convert to upper case + ADDRESS-093 + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer + ADDRESS-094 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Read one character from the UART + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Character read will be returned in a register called 'UART_data' and will be + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;echoed to the UART transmitter. + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first tests the receiver FIFO buffer to see if data is present. + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the FIFO is empty, the routine waits until there is a character to read. + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;As this could take any amount of time the wait loop includes a call to the + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;subroutine which updates the real time clock. + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 and UART_data + ADDRESS-095 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-095 + LABEL-read_from_UART + FORMATTED-INPUT s0, UART_status_port + LOGFORMAT-INPUT s0, UART_status_port[00] +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Rx_FIFO buffer + ADDRESS-096 + LABEL- + FORMATTED-TEST s0, rx_data_present + LOGFORMAT-TEST s0, rx_data_present[10] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-rx_data_present + OP2 VALUE-10 + COMMENT- + ADDRESS-097 + LABEL- + FORMATTED-JUMP NZ, read_character + LOGFORMAT-JUMP NZ, read_character[09A] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-read_character + OP2 VALUE-09A + COMMENT- + ADDRESS-098 + LABEL- + FORMATTED-CALL update_time + LOGFORMAT-CALL update_time[185] +INSTRUCTION-CALL + OPERAND1-update_time + OP1 VALUE-185 + OPERAND2- + OP2 VALUE- + COMMENT-;Perform useful operation whilst waiting + ADDRESS-099 + LABEL- + FORMATTED-JUMP read_from_UART + LOGFORMAT-JUMP read_from_UART[095] +INSTRUCTION-JUMP + OPERAND1-read_from_UART + OP1 VALUE-095 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-09A + LABEL-read_character + FORMATTED-INPUT UART_data, UART_read_port + LOGFORMAT-INPUT UART_data[sF], UART_read_port[01] +INSTRUCTION-INPUT + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-UART_read_port + OP2 VALUE-01 + COMMENT-;read from FIFO + ADDRESS-09B + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT-;echo received character + ADDRESS-09C + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit one character to the UART + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Character supplied in register called 'UART_data'. + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first tests the transmit FIFO buffer to see if it is full. + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the FIFO is full, the routine waits until there is space which could + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;be as long as it takes to transmit one complete character. + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Baud Rate Time per Character (10 bits) + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 9600 1,024us + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 19200 521us + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 38400 260us + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 57600 174us + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; 115200 87us + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Since this is a relatively long duration, the wait loop includes a + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;call to the subroutine which updates the real time clock. + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 + ADDRESS-09D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-09D + LABEL-send_to_UART + FORMATTED-INPUT s0, UART_status_port + LOGFORMAT-INPUT s0, UART_status_port[00] +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Tx_FIFO buffer + ADDRESS-09E + LABEL- + FORMATTED-TEST s0, tx_full + LOGFORMAT-TEST s0, tx_full[02] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-tx_full + OP2 VALUE-02 + COMMENT- + ADDRESS-09F + LABEL- + FORMATTED-JUMP Z, UART_write + LOGFORMAT-JUMP Z, UART_write[0A2] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-UART_write + OP2 VALUE-0A2 + COMMENT- + ADDRESS-0A0 + LABEL- + FORMATTED-CALL update_time + LOGFORMAT-CALL update_time[185] +INSTRUCTION-CALL + OPERAND1-update_time + OP1 VALUE-185 + OPERAND2- + OP2 VALUE- + COMMENT-;Perform useful operation whilst waiting + ADDRESS-0A1 + LABEL- + FORMATTED-JUMP send_to_UART + LOGFORMAT-JUMP send_to_UART[09D] +INSTRUCTION-JUMP + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0A2 + LABEL-UART_write + FORMATTED-OUTPUT UART_data, UART_write_port + LOGFORMAT-OUTPUT UART_data[sF], UART_write_port[01] +INSTRUCTION-OUTPUT + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-UART_write_port + OP2 VALUE-01 + COMMENT- + ADDRESS-0A3 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Alarm output + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Uses the alarm status scratch pad memory to set or reset the alarm + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;control bit on the alarm output port. + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 + ADDRESS-0A4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A4 + LABEL-alarm_drive + FORMATTED-FETCH s0, alarm_status + LOGFORMAT-FETCH s0, alarm_status[0C] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;read status + ADDRESS-0A5 + LABEL- + FORMATTED-AND s0, alarm_active + LOGFORMAT-AND s0, alarm_active[01] +INSTRUCTION-AND + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_active + OP2 VALUE-01 + COMMENT-;isolate bit0 + ADDRESS-0A6 + LABEL- + FORMATTED-OUTPUT s0, alarm_port + LOGFORMAT-OUTPUT s0, alarm_port[00] +INSTRUCTION-OUTPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_port + OP2 VALUE-00 + COMMENT- + ADDRESS-0A7 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit the time to the UART port in the format hh:mm:ss and end + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;with a carriage return. + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;first location. + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Address Data + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer ----> hours + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string will then be transmitted. + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ADDRESS-0A8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0A8 + LABEL-transmit_time + FORMATTED-LOAD store_pointer, real_time_hours + LOGFORMAT-LOAD store_pointer[sE], real_time_hours[06] +INSTRUCTION-LOAD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;locate current time in memory + ADDRESS-0A9 + LABEL- + FORMATTED-CALL time_to_ASCII + LOGFORMAT-CALL time_to_ASCII[160] +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OP1 VALUE-160 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AA + LABEL- + FORMATTED-CALL transmit_string + LOGFORMAT-CALL transmit_string[0BC] +INSTRUCTION-CALL + OPERAND1-transmit_string + OP1 VALUE-0BC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AB + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;ending with carriage return. + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The alarm time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;first location. + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Address Data + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer ----> hours + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine first converts the time into an ASCII string stored in scratch + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;pad memory starting at a location specified by a constant named 'string_start'. + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string will then be transmitted. + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ADDRESS-0AC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0AC + LABEL-transmit_alarm_time + FORMATTED-LOAD store_pointer, alarm_time_hours + LOGFORMAT-LOAD store_pointer[sE], alarm_time_hours[09] +INSTRUCTION-LOAD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT-;locate alarm time in memory + ADDRESS-0AD + LABEL- + FORMATTED-CALL time_to_ASCII + LOGFORMAT-CALL time_to_ASCII[160] +INSTRUCTION-CALL + OPERAND1-time_to_ASCII + OP1 VALUE-160 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AE + LABEL- + FORMATTED-CALL transmit_string + LOGFORMAT-CALL transmit_string[0BC] +INSTRUCTION-CALL + OPERAND1-transmit_string + OP1 VALUE-0BC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0AF + LABEL- + FORMATTED-CALL send_Alarm + LOGFORMAT-CALL send_Alarm[13D] +INSTRUCTION-CALL + OPERAND1-send_Alarm + OP1 VALUE-13D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B0 + LABEL- + FORMATTED-CALL send_space + LOGFORMAT-CALL send_space[0E7] +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B1 + LABEL- + FORMATTED-FETCH s0, alarm_status + LOGFORMAT-FETCH s0, alarm_status[0C] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;read alarm status + ADDRESS-0B2 + LABEL- + FORMATTED-TEST s0, alarm_active + LOGFORMAT-TEST s0, alarm_active[01] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_active + OP2 VALUE-01 + COMMENT-;test for active + ADDRESS-0B3 + LABEL- + FORMATTED-JUMP Z, test_armed + LOGFORMAT-JUMP Z, test_armed[0B6] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-test_armed + OP2 VALUE-0B6 + COMMENT- + ADDRESS-0B4 + LABEL- + FORMATTED-CALL send_Active + LOGFORMAT-CALL send_Active[153] +INSTRUCTION-CALL + OPERAND1-send_Active + OP1 VALUE-153 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B5 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B6 + LABEL-test_armed + FORMATTED-TEST s0, alarm_armed + LOGFORMAT-TEST s0, alarm_armed[02] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_armed + OP2 VALUE-02 + COMMENT-;test for on + ADDRESS-0B7 + LABEL- + FORMATTED-JUMP Z, alarm_is_off + LOGFORMAT-JUMP Z, alarm_is_off[0BA] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-alarm_is_off + OP2 VALUE-0BA + COMMENT- + ADDRESS-0B8 + LABEL- + FORMATTED-CALL send_ON + LOGFORMAT-CALL send_ON[14E] +INSTRUCTION-CALL + OPERAND1-send_ON + OP1 VALUE-14E + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0B9 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0BA + LABEL-alarm_is_off + FORMATTED-CALL send_OFF + LOGFORMAT-CALL send_OFF[148] +INSTRUCTION-CALL + OPERAND1-send_OFF + OP1 VALUE-148 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0BB + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit ASCII string to UART + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;An ASCII string must be provided in scratch pad memory commencing at the + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;location specified by a constant named 'string_start'. The string must + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;end with a carriage return (0D). + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s1 and 'UART_data'. + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; s0 is then used in subroutine 'send_to_UART' + ADDRESS-0BC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0BC + LABEL-transmit_string + FORMATTED-LOAD s1, string_start + LOGFORMAT-LOAD s1, string_start[20] +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;locate start of string + ADDRESS-0BD + LABEL-next_char_tx + FORMATTED-FETCH UART_data, (s1) + LOGFORMAT-FETCH UART_data[sF], (s1) +INSTRUCTION-FETCH + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;read character from memory + ADDRESS-0BE + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT-;transmit character + ADDRESS-0BF + LABEL- + FORMATTED-COMPARE UART_data, character_CR + LOGFORMAT-COMPARE UART_data[sF], character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;test for last character + ADDRESS-0C0 + LABEL- + FORMATTED-RETURN Z + LOGFORMAT-RETURN Z +INSTRUCTION-RETURN + OPERAND1-Z + OP1 VALUE-Z + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0C1 + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move to next character + ADDRESS-0C2 + LABEL- + FORMATTED-JUMP next_char_tx + LOGFORMAT-JUMP next_char_tx[0BD] +INSTRUCTION-JUMP + OPERAND1-next_char_tx + OP1 VALUE-0BD + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Receive ASCII string from UART + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;An ASCII string will be read from the UART and stored in scratch pad memory + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;commencing at the location specified by a constant named 'string_start'. + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string will will have a maximum length of 16 characters including a + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;carriage return (0D) denoting the end of the string. + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;As each character is read, it is echoed to the UART transmitter. + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Some minor editing is supported using backspace (BS=08) which is used + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;to adjust what is stored in scratch pad memory and adjust the display + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;on the terminal screen using characters sent to the UART transmitter. + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;A test is made for the receiver FIFO becoming full. A full status is treated as + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;a potential error situation and will result in a 'Overflow Error' message being + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;transmitted to the UART, the receiver FIFO being purged of all data and an + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;empty string being stored (carriage return at first location). + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2 and 'UART_data'. + ADDRESS-0C3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0C3 + LABEL-receive_string + FORMATTED-LOAD s1, string_start + LOGFORMAT-LOAD s1, string_start[20] +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;locate start of string + ADDRESS-0C4 + LABEL- + FORMATTED-LOAD s2, s1 + LOGFORMAT-LOAD s2, s1 +INSTRUCTION-LOAD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT-;compute 16 character address + ADDRESS-0C5 + LABEL- + FORMATTED-ADD s2, 10 + LOGFORMAT-ADD s2, 10 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-10 + OP2 VALUE-10 + COMMENT- + ADDRESS-0C6 + LABEL-receive_full_test + FORMATTED-INPUT s0, UART_status_port + LOGFORMAT-INPUT s0, UART_status_port[00] +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Rx_FIFO buffer for full + ADDRESS-0C7 + LABEL- + FORMATTED-TEST s0, rx_full + LOGFORMAT-TEST s0, rx_full[08] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-rx_full + OP2 VALUE-08 + COMMENT- + ADDRESS-0C8 + LABEL- + FORMATTED-JUMP NZ, read_error + LOGFORMAT-JUMP NZ, read_error[0DB] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-read_error + OP2 VALUE-0DB + COMMENT- + ADDRESS-0C9 + LABEL- + FORMATTED-CALL read_from_UART + LOGFORMAT-CALL read_from_UART[095] +INSTRUCTION-CALL + OPERAND1-read_from_UART + OP1 VALUE-095 + OPERAND2- + OP2 VALUE- + COMMENT-;obtain and echo character + ADDRESS-0CA + LABEL- + FORMATTED-STORE UART_data, (s1) + LOGFORMAT-STORE UART_data[sF], (s1) +INSTRUCTION-STORE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;write to memory + ADDRESS-0CB + LABEL- + FORMATTED-COMPARE UART_data, character_CR + LOGFORMAT-COMPARE UART_data[sF], character_CR[0D] +INSTRUCTION-COMPARE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;test for end of string + ADDRESS-0CC + LABEL- + FORMATTED-RETURN Z + LOGFORMAT-RETURN Z +INSTRUCTION-RETURN + OPERAND1-Z + OP1 VALUE-Z + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0CD + LABEL- + FORMATTED-COMPARE UART_data, character_BS + LOGFORMAT-COMPARE UART_data[sF], character_BS[08] +INSTRUCTION-COMPARE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_BS + OP2 VALUE-08 + COMMENT-;test for back space + ADDRESS-0CE + LABEL- + FORMATTED-JUMP Z, BS_edit + LOGFORMAT-JUMP Z, BS_edit[0D3] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-BS_edit + OP2 VALUE-0D3 + COMMENT- + ADDRESS-0CF + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment memory pointer + ADDRESS-0D0 + LABEL- + FORMATTED-COMPARE s1, s2 + LOGFORMAT-COMPARE s1, s2 +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;test for pointer exceeding 16 characters + ADDRESS-0D1 + LABEL- + FORMATTED-JUMP NZ, receive_full_test + LOGFORMAT-JUMP NZ, receive_full_test[0C6] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-receive_full_test + OP2 VALUE-0C6 + COMMENT-;next character + ADDRESS-0D2 + LABEL- + FORMATTED-CALL send_backspace + LOGFORMAT-CALL send_backspace[0EA] +INSTRUCTION-CALL + OPERAND1-send_backspace + OP1 VALUE-0EA + OPERAND2- + OP2 VALUE- + COMMENT-;hold end of string position on terminal display + ADDRESS-0D3 + LABEL-BS_edit + FORMATTED-SUB s1, 01 + LOGFORMAT-SUB s1, 01 +INSTRUCTION-SUB + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;memory pointer back one + ADDRESS-0D4 + LABEL- + FORMATTED-COMPARE s1, string_start + LOGFORMAT-COMPARE s1, string_start[20] +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;test for under flow + ADDRESS-0D5 + LABEL- + FORMATTED-JUMP C, string_start_again + LOGFORMAT-JUMP C, string_start_again[0D9] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-string_start_again + OP2 VALUE-0D9 + COMMENT- + ADDRESS-0D6 + LABEL- + FORMATTED-CALL send_space + LOGFORMAT-CALL send_space[0E7] +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT-;clear character at current position + ADDRESS-0D7 + LABEL- + FORMATTED-CALL send_backspace + LOGFORMAT-CALL send_backspace[0EA] +INSTRUCTION-CALL + OPERAND1-send_backspace + OP1 VALUE-0EA + OPERAND2- + OP2 VALUE- + COMMENT-;position cursor + ADDRESS-0D8 + LABEL- + FORMATTED-JUMP receive_full_test + LOGFORMAT-JUMP receive_full_test[0C6] +INSTRUCTION-JUMP + OPERAND1-receive_full_test + OP1 VALUE-0C6 + OPERAND2- + OP2 VALUE- + COMMENT-;next character + ADDRESS-0D9 + LABEL-string_start_again + FORMATTED-CALL send_greater_than + LOGFORMAT-CALL send_greater_than[122] +INSTRUCTION-CALL + OPERAND1-send_greater_than + OP1 VALUE-122 + OPERAND2- + OP2 VALUE- + COMMENT-;restore '>' at prompt + ADDRESS-0DA + LABEL- + FORMATTED-JUMP receive_string + LOGFORMAT-JUMP receive_string[0C3] +INSTRUCTION-JUMP + OPERAND1-receive_string + OP1 VALUE-0C3 + OPERAND2- + OP2 VALUE- + COMMENT-;begin again + ADDRESS-0DB + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Receiver buffer overflow condition + ADDRESS-0DB + LABEL-read_error + FORMATTED-CALL send_CR + LOGFORMAT-CALL send_CR[0E4] +INSTRUCTION-CALL + OPERAND1-send_CR + OP1 VALUE-0E4 + OPERAND2- + OP2 VALUE- + COMMENT-;Transmit error message + ADDRESS-0DC + LABEL- + FORMATTED-STORE UART_data, string_start + LOGFORMAT-STORE UART_data[sF], string_start[20] +INSTRUCTION-STORE + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;empty string in memory (start with CR) + ADDRESS-0DD + LABEL- + FORMATTED-CALL send_Overflow_Error + LOGFORMAT-CALL send_Overflow_Error[0FA] +INSTRUCTION-CALL + OPERAND1-send_Overflow_Error + OP1 VALUE-0FA + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0DE + LABEL- + FORMATTED-CALL send_CR + LOGFORMAT-CALL send_CR[0E4] +INSTRUCTION-CALL + OPERAND1-send_CR + OP1 VALUE-0E4 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0DF + LABEL-clear_UART_Rx_loop + FORMATTED-INPUT s0, UART_status_port + LOGFORMAT-INPUT s0, UART_status_port[00] +INSTRUCTION-INPUT + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-UART_status_port + OP2 VALUE-00 + COMMENT-;test Rx_FIFO buffer for data + ADDRESS-0E0 + LABEL- + FORMATTED-TEST s0, rx_data_present + LOGFORMAT-TEST s0, rx_data_present[10] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-rx_data_present + OP2 VALUE-10 + COMMENT- + ADDRESS-0E1 + LABEL- + FORMATTED-RETURN Z + LOGFORMAT-RETURN Z +INSTRUCTION-RETURN + OPERAND1-Z + OP1 VALUE-Z + OPERAND2- + OP2 VALUE- + COMMENT-;finish when buffer is empty + ADDRESS-0E2 + LABEL- + FORMATTED-INPUT UART_data, UART_read_port + LOGFORMAT-INPUT UART_data[sF], UART_read_port[01] +INSTRUCTION-INPUT + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-UART_read_port + OP2 VALUE-01 + COMMENT-;read from FIFO and ignore + ADDRESS-0E3 + LABEL- + FORMATTED-JUMP clear_UART_Rx_loop + LOGFORMAT-JUMP clear_UART_Rx_loop[0DF] +INSTRUCTION-JUMP + OPERAND1-clear_UART_Rx_loop + OP1 VALUE-0DF + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send Carriage Return to the UART + ADDRESS-0E4 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E4 + LABEL-send_CR + FORMATTED-LOAD UART_data, character_CR + LOGFORMAT-LOAD UART_data[sF], character_CR[0D] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT- + ADDRESS-0E5 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E6 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E7 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send a space to the UART + ADDRESS-0E7 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0E7 + LABEL-send_space + FORMATTED-LOAD UART_data, character_space + LOGFORMAT-LOAD UART_data[sF], character_space[20] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_space + OP2 VALUE-20 + COMMENT- + ADDRESS-0E8 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0E9 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0EA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0EA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0EA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send a back space to the UART + ADDRESS-0EA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0EA + LABEL-send_backspace + FORMATTED-LOAD UART_data, character_BS + LOGFORMAT-LOAD UART_data[sF], character_BS[08] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_BS + OP2 VALUE-08 + COMMENT- + ADDRESS-0EB + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0EC + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0ED + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0ED + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Syntax Error' to the UART + ADDRESS-0ED + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0ED + LABEL-send_Syntax_Error + FORMATTED-LOAD UART_data, character_S + LOGFORMAT-LOAD UART_data[sF], character_S[53] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_S + OP2 VALUE-53 + COMMENT- + ADDRESS-0EE + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0EF + LABEL- + FORMATTED-LOAD UART_data, character_y + LOGFORMAT-LOAD UART_data[sF], character_y[79] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_y + OP2 VALUE-79 + COMMENT- + ADDRESS-0F0 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F1 + LABEL- + FORMATTED-LOAD UART_data, character_n + LOGFORMAT-LOAD UART_data[sF], character_n[6E] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_n + OP2 VALUE-6E + COMMENT- + ADDRESS-0F2 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F3 + LABEL- + FORMATTED-LOAD UART_data, character_t + LOGFORMAT-LOAD UART_data[sF], character_t[74] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_t + OP2 VALUE-74 + COMMENT- + ADDRESS-0F4 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F5 + LABEL- + FORMATTED-LOAD UART_data, character_a + LOGFORMAT-LOAD UART_data[sF], character_a[61] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_a + OP2 VALUE-61 + COMMENT- + ADDRESS-0F6 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F7 + LABEL- + FORMATTED-LOAD UART_data, character_x + LOGFORMAT-LOAD UART_data[sF], character_x[78] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_x + OP2 VALUE-78 + COMMENT- + ADDRESS-0F8 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0F9 + LABEL- + FORMATTED-JUMP send_space_Error + LOGFORMAT-JUMP send_space_Error[10A] +INSTRUCTION-JUMP + OPERAND1-send_space_Error + OP1 VALUE-10A + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Overflow Error' to the UART + ADDRESS-0FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-0FA + LABEL-send_Overflow_Error + FORMATTED-LOAD UART_data, character_O + LOGFORMAT-LOAD UART_data[sF], character_O[4F] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-0FB + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0FC + LABEL- + FORMATTED-LOAD UART_data, character_v + LOGFORMAT-LOAD UART_data[sF], character_v[76] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_v + OP2 VALUE-76 + COMMENT- + ADDRESS-0FD + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-0FE + LABEL- + FORMATTED-LOAD UART_data, character_e + LOGFORMAT-LOAD UART_data[sF], character_e[65] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_e + OP2 VALUE-65 + COMMENT- + ADDRESS-0FF + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-100 + LABEL- + FORMATTED-LOAD UART_data, character_r + LOGFORMAT-LOAD UART_data[sF], character_r[72] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-101 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-102 + LABEL- + FORMATTED-LOAD UART_data, character_f + LOGFORMAT-LOAD UART_data[sF], character_f[66] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_f + OP2 VALUE-66 + COMMENT- + ADDRESS-103 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-104 + LABEL- + FORMATTED-LOAD UART_data, character_l + LOGFORMAT-LOAD UART_data[sF], character_l[6C] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_l + OP2 VALUE-6C + COMMENT- + ADDRESS-105 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-106 + LABEL- + FORMATTED-LOAD UART_data, character_o + LOGFORMAT-LOAD UART_data[sF], character_o[6F] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_o + OP2 VALUE-6F + COMMENT- + ADDRESS-107 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-108 + LABEL- + FORMATTED-LOAD UART_data, character_w + LOGFORMAT-LOAD UART_data[sF], character_w[77] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_w + OP2 VALUE-77 + COMMENT- + ADDRESS-109 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10A + LABEL-send_space_Error + FORMATTED-CALL send_space + LOGFORMAT-CALL send_space[0E7] +INSTRUCTION-CALL + OPERAND1-send_space + OP1 VALUE-0E7 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10B + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-10B + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Error' to the UART + ADDRESS-10B + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-10B + LABEL-send_Error + FORMATTED-LOAD UART_data, character_E + LOGFORMAT-LOAD UART_data[sF], character_E[45] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_E + OP2 VALUE-45 + COMMENT- + ADDRESS-10C + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10D + LABEL- + FORMATTED-LOAD UART_data, character_r + LOGFORMAT-LOAD UART_data[sF], character_r[72] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-10E + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-10F + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-110 + LABEL- + FORMATTED-LOAD UART_data, character_o + LOGFORMAT-LOAD UART_data[sF], character_o[6F] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_o + OP2 VALUE-6F + COMMENT- + ADDRESS-111 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-112 + LABEL- + FORMATTED-LOAD UART_data, character_r + LOGFORMAT-LOAD UART_data[sF], character_r[72] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-113 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-114 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-115 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-115 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'KCPSM3>' prompt to the UART + ADDRESS-115 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-115 + LABEL-send_prompt + FORMATTED-CALL send_CR + LOGFORMAT-CALL send_CR[0E4] +INSTRUCTION-CALL + OPERAND1-send_CR + OP1 VALUE-0E4 + OPERAND2- + OP2 VALUE- + COMMENT-;start new line + ADDRESS-116 + LABEL- + FORMATTED-LOAD UART_data, character_K + LOGFORMAT-LOAD UART_data[sF], character_K[4B] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_K + OP2 VALUE-4B + COMMENT- + ADDRESS-117 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-118 + LABEL- + FORMATTED-LOAD UART_data, character_C + LOGFORMAT-LOAD UART_data[sF], character_C[43] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_C + OP2 VALUE-43 + COMMENT- + ADDRESS-119 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-11A + LABEL- + FORMATTED-LOAD UART_data, character_P + LOGFORMAT-LOAD UART_data[sF], character_P[50] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_P + OP2 VALUE-50 + COMMENT- + ADDRESS-11B + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-11C + LABEL- + FORMATTED-LOAD UART_data, character_S + LOGFORMAT-LOAD UART_data[sF], character_S[53] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_S + OP2 VALUE-53 + COMMENT- + ADDRESS-11D + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-11E + LABEL- + FORMATTED-LOAD UART_data, character_M + LOGFORMAT-LOAD UART_data[sF], character_M[4D] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_M + OP2 VALUE-4D + COMMENT- + ADDRESS-11F + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-120 + LABEL- + FORMATTED-LOAD UART_data, character_3 + LOGFORMAT-LOAD UART_data[sF], character_3[33] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_3 + OP2 VALUE-33 + COMMENT- + ADDRESS-121 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-122 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-122 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send '>' character to the UART + ADDRESS-122 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-122 + LABEL-send_greater_than + FORMATTED-LOAD UART_data, character_greater_than + LOGFORMAT-LOAD UART_data[sF], character_greater_than[3E] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_greater_than + OP2 VALUE-3E + COMMENT- + ADDRESS-123 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-124 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-125 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-125 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Invalid' string to the UART + ADDRESS-125 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-125 + LABEL-send_Invalid + FORMATTED-LOAD UART_data, character_I + LOGFORMAT-LOAD UART_data[sF], character_I[49] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_I + OP2 VALUE-49 + COMMENT- + ADDRESS-126 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-127 + LABEL- + FORMATTED-LOAD UART_data, character_n + LOGFORMAT-LOAD UART_data[sF], character_n[6E] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_n + OP2 VALUE-6E + COMMENT- + ADDRESS-128 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-129 + LABEL- + FORMATTED-LOAD UART_data, character_v + LOGFORMAT-LOAD UART_data[sF], character_v[76] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_v + OP2 VALUE-76 + COMMENT- + ADDRESS-12A + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-12B + LABEL- + FORMATTED-LOAD UART_data, character_a + LOGFORMAT-LOAD UART_data[sF], character_a[61] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_a + OP2 VALUE-61 + COMMENT- + ADDRESS-12C + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-12D + LABEL- + FORMATTED-LOAD UART_data, character_l + LOGFORMAT-LOAD UART_data[sF], character_l[6C] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_l + OP2 VALUE-6C + COMMENT- + ADDRESS-12E + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-12F + LABEL- + FORMATTED-LOAD UART_data, character_i + LOGFORMAT-LOAD UART_data[sF], character_i[69] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_i + OP2 VALUE-69 + COMMENT- + ADDRESS-130 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-131 + LABEL- + FORMATTED-LOAD UART_data, character_d + LOGFORMAT-LOAD UART_data[sF], character_d[64] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_d + OP2 VALUE-64 + COMMENT- + ADDRESS-132 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-133 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-134 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-134 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Time' string to the UART + ADDRESS-134 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-134 + LABEL-send_Time + FORMATTED-LOAD UART_data, character_T + LOGFORMAT-LOAD UART_data[sF], character_T[54] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_T + OP2 VALUE-54 + COMMENT- + ADDRESS-135 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-136 + LABEL- + FORMATTED-LOAD UART_data, character_i + LOGFORMAT-LOAD UART_data[sF], character_i[69] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_i + OP2 VALUE-69 + COMMENT- + ADDRESS-137 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-138 + LABEL- + FORMATTED-LOAD UART_data, character_m + LOGFORMAT-LOAD UART_data[sF], character_m[6D] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_m + OP2 VALUE-6D + COMMENT- + ADDRESS-139 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13A + LABEL- + FORMATTED-LOAD UART_data, character_e + LOGFORMAT-LOAD UART_data[sF], character_e[65] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_e + OP2 VALUE-65 + COMMENT- + ADDRESS-13B + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13C + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-13D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Alarm' string to the UART + ADDRESS-13D + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-13D + LABEL-send_Alarm + FORMATTED-LOAD UART_data, character_A + LOGFORMAT-LOAD UART_data[sF], character_A[41] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_A + OP2 VALUE-41 + COMMENT- + ADDRESS-13E + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-13F + LABEL- + FORMATTED-LOAD UART_data, character_l + LOGFORMAT-LOAD UART_data[sF], character_l[6C] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_l + OP2 VALUE-6C + COMMENT- + ADDRESS-140 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-141 + LABEL- + FORMATTED-LOAD UART_data, character_a + LOGFORMAT-LOAD UART_data[sF], character_a[61] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_a + OP2 VALUE-61 + COMMENT- + ADDRESS-142 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-143 + LABEL- + FORMATTED-LOAD UART_data, character_r + LOGFORMAT-LOAD UART_data[sF], character_r[72] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_r + OP2 VALUE-72 + COMMENT- + ADDRESS-144 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-145 + LABEL- + FORMATTED-LOAD UART_data, character_m + LOGFORMAT-LOAD UART_data[sF], character_m[6D] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_m + OP2 VALUE-6D + COMMENT- + ADDRESS-146 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-147 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-148 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-148 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'OFF' string to the UART + ADDRESS-148 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-148 + LABEL-send_OFF + FORMATTED-LOAD UART_data, character_O + LOGFORMAT-LOAD UART_data[sF], character_O[4F] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-149 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14A + LABEL- + FORMATTED-LOAD UART_data, character_F + LOGFORMAT-LOAD UART_data[sF], character_F[46] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_F + OP2 VALUE-46 + COMMENT- + ADDRESS-14B + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14C + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14D + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-14E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-14E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'ON' string to the UART + ADDRESS-14E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-14E + LABEL-send_ON + FORMATTED-LOAD UART_data, character_O + LOGFORMAT-LOAD UART_data[sF], character_O[4F] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_O + OP2 VALUE-4F + COMMENT- + ADDRESS-14F + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-150 + LABEL- + FORMATTED-LOAD UART_data, character_N + LOGFORMAT-LOAD UART_data[sF], character_N[4E] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_N + OP2 VALUE-4E + COMMENT- + ADDRESS-151 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-152 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-153 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-153 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Send 'Active' string to the UART + ADDRESS-153 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-153 + LABEL-send_Active + FORMATTED-LOAD UART_data, character_A + LOGFORMAT-LOAD UART_data[sF], character_A[41] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_A + OP2 VALUE-41 + COMMENT- + ADDRESS-154 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-155 + LABEL- + FORMATTED-LOAD UART_data, character_c + LOGFORMAT-LOAD UART_data[sF], character_c[63] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_c + OP2 VALUE-63 + COMMENT- + ADDRESS-156 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-157 + LABEL- + FORMATTED-LOAD UART_data, character_t + LOGFORMAT-LOAD UART_data[sF], character_t[74] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_t + OP2 VALUE-74 + COMMENT- + ADDRESS-158 + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-159 + LABEL- + FORMATTED-LOAD UART_data, character_i + LOGFORMAT-LOAD UART_data[sF], character_i[69] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_i + OP2 VALUE-69 + COMMENT- + ADDRESS-15A + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-15B + LABEL- + FORMATTED-LOAD UART_data, character_v + LOGFORMAT-LOAD UART_data[sF], character_v[76] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_v + OP2 VALUE-76 + COMMENT- + ADDRESS-15C + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-15D + LABEL- + FORMATTED-LOAD UART_data, character_e + LOGFORMAT-LOAD UART_data[sF], character_e[65] +INSTRUCTION-LOAD + OPERAND1-UART_data + OP1 VALUE-sF + OPERAND2-character_e + OP2 VALUE-65 + COMMENT- + ADDRESS-15E + LABEL- + FORMATTED-CALL send_to_UART + LOGFORMAT-CALL send_to_UART[09D] +INSTRUCTION-CALL + OPERAND1-send_to_UART + OP1 VALUE-09D + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-15F + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert time to ASCII string in scratch pad memory. + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The time to converted must be stored in 3 scratch pad memory locations as + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;defined below. A register named 'store_pointer' must provide the address of + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;first location. + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; Address Data + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer ----> hours + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> minutes + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; store_pointer + 1 ----> seconds + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The resulting ASCII string will be stored in scratch pad memory starting at + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;a location specified by a constant named 'string_start'. The string will + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;take the format hh:mm:ss and end with a carriage return. + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1, s2 and 'store_pointer'. + ADDRESS-160 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-160 + LABEL-time_to_ASCII + FORMATTED-LOAD s2, string_start + LOGFORMAT-LOAD s2, string_start[20] +INSTRUCTION-LOAD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-string_start + OP2 VALUE-20 + COMMENT-;location for string + ADDRESS-161 + LABEL- + FORMATTED-FETCH s0, (store_pointer) + LOGFORMAT-FETCH s0, (store_pointer)[(sE)] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(store_pointer) + OP2 VALUE-(sE) + COMMENT-;read hours value + ADDRESS-162 + LABEL- + FORMATTED-CALL decimal_to_ASCII + LOGFORMAT-CALL decimal_to_ASCII[17E] +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OP1 VALUE-17E + OPERAND2- + OP2 VALUE- + COMMENT-;convert to ASCII + ADDRESS-163 + LABEL- + FORMATTED-STORE s1, (s2) + LOGFORMAT-STORE s1, (s2) +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT-;write hours to string + ADDRESS-164 + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-165 + LABEL- + FORMATTED-STORE s0, (s2) + LOGFORMAT-STORE s0, (s2) +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-166 + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-167 + LABEL- + FORMATTED-LOAD s0, character_colon + LOGFORMAT-LOAD s0, character_colon[3A] +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;write ':' to string + ADDRESS-168 + LABEL- + FORMATTED-STORE s0, (s2) + LOGFORMAT-STORE s0, (s2) +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-169 + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-16A + LABEL- + FORMATTED-ADD store_pointer, 01 + LOGFORMAT-ADD store_pointer[sE], 01 +INSTRUCTION-ADD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move to minutes + ADDRESS-16B + LABEL- + FORMATTED-FETCH s0, (store_pointer) + LOGFORMAT-FETCH s0, (store_pointer)[(sE)] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(store_pointer) + OP2 VALUE-(sE) + COMMENT-;read minutes value + ADDRESS-16C + LABEL- + FORMATTED-CALL decimal_to_ASCII + LOGFORMAT-CALL decimal_to_ASCII[17E] +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OP1 VALUE-17E + OPERAND2- + OP2 VALUE- + COMMENT-;convert to ASCII + ADDRESS-16D + LABEL- + FORMATTED-STORE s1, (s2) + LOGFORMAT-STORE s1, (s2) +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT-;write minutes to string + ADDRESS-16E + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-16F + LABEL- + FORMATTED-STORE s0, (s2) + LOGFORMAT-STORE s0, (s2) +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-170 + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-171 + LABEL- + FORMATTED-LOAD s0, character_colon + LOGFORMAT-LOAD s0, character_colon[3A] +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_colon + OP2 VALUE-3A + COMMENT-;write ':' to string + ADDRESS-172 + LABEL- + FORMATTED-STORE s0, (s2) + LOGFORMAT-STORE s0, (s2) +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-173 + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-174 + LABEL- + FORMATTED-ADD store_pointer, 01 + LOGFORMAT-ADD store_pointer[sE], 01 +INSTRUCTION-ADD + OPERAND1-store_pointer + OP1 VALUE-sE + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;move to seconds + ADDRESS-175 + LABEL- + FORMATTED-FETCH s0, (store_pointer) + LOGFORMAT-FETCH s0, (store_pointer)[(sE)] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(store_pointer) + OP2 VALUE-(sE) + COMMENT-;read seconds value + ADDRESS-176 + LABEL- + FORMATTED-CALL decimal_to_ASCII + LOGFORMAT-CALL decimal_to_ASCII[17E] +INSTRUCTION-CALL + OPERAND1-decimal_to_ASCII + OP1 VALUE-17E + OPERAND2- + OP2 VALUE- + COMMENT-;convert to ASCII + ADDRESS-177 + LABEL- + FORMATTED-STORE s1, (s2) + LOGFORMAT-STORE s1, (s2) +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT-;write seconds to string + ADDRESS-178 + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-179 + LABEL- + FORMATTED-STORE s0, (s2) + LOGFORMAT-STORE s0, (s2) +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-17A + LABEL- + FORMATTED-ADD s2, 01 + LOGFORMAT-ADD s2, 01 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-01 + OP2 VALUE-01 + COMMENT- + ADDRESS-17B + LABEL- + FORMATTED-LOAD s0, character_CR + LOGFORMAT-LOAD s0, character_CR[0D] +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-character_CR + OP2 VALUE-0D + COMMENT-;finish string with carriage return + ADDRESS-17C + LABEL- + FORMATTED-STORE s0, (s2) + LOGFORMAT-STORE s0, (s2) +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s2) + OP2 VALUE-(s2) + COMMENT- + ADDRESS-17D + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert value provided in register s0 into ASCII characters + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The value provided must in the range 0 to 99 and will be converted into + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;two ASCII characters. + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; The number of 'tens' will be representd by an ASCII character returned in register s1. + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; The number of 'units' will be representd by an ASCII character returned in register s0. + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;the actual decimal value. + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0 and s1. + ADDRESS-17E + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-17E + LABEL-decimal_to_ASCII + FORMATTED-LOAD s1, 30 + LOGFORMAT-LOAD s1, 30 +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-30 + OP2 VALUE-30 + COMMENT-;load 'tens' counter with ASCII for '0' + ADDRESS-17F + LABEL-test_for_ten + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment 'tens' value + ADDRESS-180 + LABEL- + FORMATTED-SUB s0, 0A + LOGFORMAT-SUB s0, 0A +INSTRUCTION-SUB + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-0A + OP2 VALUE-0A + COMMENT-;try to subtract 10 from the supplied value + ADDRESS-181 + LABEL- + FORMATTED-JUMP NC, test_for_ten + LOGFORMAT-JUMP NC, test_for_ten[17F] +INSTRUCTION-JUMP + OPERAND1-NC + OP1 VALUE-NC + OPERAND2-test_for_ten + OP2 VALUE-17F + COMMENT-;repeat if subtraction was possible without underflow. + ADDRESS-182 + LABEL- + FORMATTED-SUB s1, 01 + LOGFORMAT-SUB s1, 01 +INSTRUCTION-SUB + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;'tens' value one less ten due to underflow + ADDRESS-183 + LABEL- + FORMATTED-ADD s0, 3A + LOGFORMAT-ADD s0, 3A +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-3A + OP2 VALUE-3A + COMMENT-;restore units value (the remainder) and convert to ASCII + ADDRESS-184 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Real Time Clock + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;micro-seconds have elapsed since the last update. This allows for just over 65ms between + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;is used to update the real time hours, minutes and seconds clock held in scratch pad + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;memory during the routine and restored before returning. + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Useful constants for real time clock operations + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL- + FORMATTED-CONSTANT count_1000_lsb, E8 + LOGFORMAT-CONSTANT count_1000_lsb, E8 +INSTRUCTION-CONSTANT + OPERAND1-count_1000_lsb + OP1 VALUE-count_1000_lsb + OPERAND2-E8 + OP2 VALUE-E8 + COMMENT-;lower 8-bits of 1000 count value + ADDRESS-185 + LABEL- + FORMATTED-CONSTANT count_1000_msb, 03 + LOGFORMAT-CONSTANT count_1000_msb, 03 +INSTRUCTION-CONSTANT + OPERAND1-count_1000_msb + OP1 VALUE-count_1000_msb + OPERAND2-03 + OP2 VALUE-03 + COMMENT-;upper 8-bits of 1000 count value + ADDRESS-185 + LABEL- + FORMATTED-CONSTANT hours_in_a_day, 18 + LOGFORMAT-CONSTANT hours_in_a_day, 18 +INSTRUCTION-CONSTANT + OPERAND1-hours_in_a_day + OP1 VALUE-hours_in_a_day + OPERAND2-18 + OP2 VALUE-18 + COMMENT-;24 hours in a day + ADDRESS-185 + LABEL- + FORMATTED-CONSTANT minutes_in_an_hour, 3C + LOGFORMAT-CONSTANT minutes_in_an_hour, 3C +INSTRUCTION-CONSTANT + OPERAND1-minutes_in_an_hour + OP1 VALUE-minutes_in_an_hour + OPERAND2-3C + OP2 VALUE-3C + COMMENT-;60 minutes in an hour + ADDRESS-185 + LABEL- + FORMATTED-CONSTANT seconds_in_a_minute, 3C + LOGFORMAT-CONSTANT seconds_in_a_minute, 3C +INSTRUCTION-CONSTANT + OPERAND1-seconds_in_a_minute + OP1 VALUE-seconds_in_a_minute + OPERAND2-3C + OP2 VALUE-3C + COMMENT-;60 seconds in a minute + ADDRESS-185 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-185 + LABEL-update_time + FORMATTED-STORE s0, time_preserve0 + LOGFORMAT-STORE s0, time_preserve0[10] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-time_preserve0 + OP2 VALUE-10 + COMMENT-;preserve contents of registers used during routine + ADDRESS-186 + LABEL- + FORMATTED-STORE s1, time_preserve1 + LOGFORMAT-STORE s1, time_preserve1[11] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-time_preserve1 + OP2 VALUE-11 + COMMENT- + ADDRESS-187 + LABEL- + FORMATTED-STORE s2, time_preserve2 + LOGFORMAT-STORE s2, time_preserve2[12] +INSTRUCTION-STORE + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-time_preserve2 + OP2 VALUE-12 + COMMENT- + ADDRESS-188 + LABEL- + FORMATTED-STORE s3, time_preserve3 + LOGFORMAT-STORE s3, time_preserve3[13] +INSTRUCTION-STORE + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-time_preserve3 + OP2 VALUE-13 + COMMENT- + ADDRESS-189 + LABEL- + FORMATTED-STORE s4, time_preserve4 + LOGFORMAT-STORE s4, time_preserve4[14] +INSTRUCTION-STORE + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-time_preserve4 + OP2 VALUE-14 + COMMENT- + ADDRESS-18A + LABEL- + FORMATTED-STORE s5, time_preserve5 + LOGFORMAT-STORE s5, time_preserve5[15] +INSTRUCTION-STORE + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-time_preserve5 + OP2 VALUE-15 + COMMENT- + ADDRESS-18B + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-18B + LABEL- + FORMATTED-FETCH s2, us_time_stamp_lsb + LOGFORMAT-FETCH s2, us_time_stamp_lsb[00] +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT-;read the previous 'us' time stamp into [s3,s2] + ADDRESS-18C + LABEL- + FORMATTED-FETCH s3, us_time_stamp_msb + LOGFORMAT-FETCH s3, us_time_stamp_msb[01] +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT- + ADDRESS-18D + LABEL- + FORMATTED-DISABLE INTERRUPT + LOGFORMAT-DISABLE INTERRUPT +INSTRUCTION-DISABLE + OPERAND1-INTERRUPT + OP1 VALUE-INTERRUPT + OPERAND2- + OP2 VALUE- + COMMENT-;Read and store current 'us' time stamp provided by the interrupt + ADDRESS-18E + LABEL- + FORMATTED-STORE int_counter_lsb, us_time_stamp_lsb + LOGFORMAT-STORE int_counter_lsb[sD], us_time_stamp_lsb[00] +INSTRUCTION-STORE + OPERAND1-int_counter_lsb + OP1 VALUE-sD + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT-;counter. Interrupts are disabled to ensure that both bytes relate + ADDRESS-18F + LABEL- + FORMATTED-STORE int_counter_msb, us_time_stamp_msb + LOGFORMAT-STORE int_counter_msb[sC], us_time_stamp_msb[01] +INSTRUCTION-STORE + OPERAND1-int_counter_msb + OP1 VALUE-sC + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT-;to the same count value. + ADDRESS-190 + LABEL- + FORMATTED-ENABLE INTERRUPT + LOGFORMAT-ENABLE INTERRUPT +INSTRUCTION-ENABLE + OPERAND1-INTERRUPT + OP1 VALUE-INTERRUPT + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-191 + LABEL- + FORMATTED-FETCH s4, us_time_stamp_lsb + LOGFORMAT-FETCH s4, us_time_stamp_lsb[00] +INSTRUCTION-FETCH + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-us_time_stamp_lsb + OP2 VALUE-00 + COMMENT-;read the new 'us' time stamp in [s5,s4] + ADDRESS-192 + LABEL- + FORMATTED-FETCH s5, us_time_stamp_msb + LOGFORMAT-FETCH s5, us_time_stamp_msb[01] +INSTRUCTION-FETCH + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-us_time_stamp_msb + OP2 VALUE-01 + COMMENT-; + ADDRESS-193 + LABEL- + FORMATTED-SUB s4, s2 + LOGFORMAT-SUB s4, s2 +INSTRUCTION-SUB + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-s2 + OP2 VALUE-s2 + COMMENT-;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + ADDRESS-194 + LABEL- + FORMATTED-SUBCY s5, s3 + LOGFORMAT-SUBCY s5, s3 +INSTRUCTION-SUBCY + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-s3 + OP2 VALUE-s3 + COMMENT-; (This works correctly even if counter has rolled over) + ADDRESS-195 + LABEL- + FORMATTED-FETCH s2, us_time_lsb + LOGFORMAT-FETCH s2, us_time_lsb[02] +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-us_time_lsb + OP2 VALUE-02 + COMMENT-;read current 'us' time into [s3,s2] + ADDRESS-196 + LABEL- + FORMATTED-FETCH s3, us_time_msb + LOGFORMAT-FETCH s3, us_time_msb[03] +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-us_time_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-197 + LABEL- + FORMATTED-ADD s2, s4 + LOGFORMAT-ADD s2, s4 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s4 + OP2 VALUE-s4 + COMMENT-;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + ADDRESS-198 + LABEL- + FORMATTED-ADDCY s3, s5 + LOGFORMAT-ADDCY s3, s5 +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-s5 + OP2 VALUE-s5 + COMMENT- + ADDRESS-199 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;determine how many 1000us (1ms) units there are (if any) in current 'us' time + ADDRESS-199 + LABEL- + FORMATTED-LOAD s0, 00 + LOGFORMAT-LOAD s0, 00 +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;reset 'ms' counter + ADDRESS-19A + LABEL-test_1000us + FORMATTED-SUB s2, count_1000_lsb + LOGFORMAT-SUB s2, count_1000_lsb[E8] +INSTRUCTION-SUB + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;subtract 1000 from [s3,s2] + ADDRESS-19B + LABEL- + FORMATTED-SUBCY s3, count_1000_msb + LOGFORMAT-SUBCY s3, count_1000_msb[03] +INSTRUCTION-SUBCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-19C + LABEL- + FORMATTED-JUMP C, store_us_time + LOGFORMAT-JUMP C, store_us_time[19F] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-store_us_time + OP2 VALUE-19F + COMMENT-;Carry indicates [s3,s2] was less than 1000us + ADDRESS-19D + LABEL- + FORMATTED-ADD s0, 01 + LOGFORMAT-ADD s0, 01 +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + ADDRESS-19E + LABEL- + FORMATTED-JUMP test_1000us + LOGFORMAT-JUMP test_1000us[19A] +INSTRUCTION-JUMP + OPERAND1-test_1000us + OP1 VALUE-19A + OPERAND2- + OP2 VALUE- + COMMENT-;repeat to see if more than 1ms has elapsed + ADDRESS-19F + LABEL-store_us_time + FORMATTED-ADD s2, count_1000_lsb + LOGFORMAT-ADD s2, count_1000_lsb[E8] +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;add 1000 to restore 'us' value + ADDRESS-1A0 + LABEL- + FORMATTED-ADDCY s3, count_1000_msb + LOGFORMAT-ADDCY s3, count_1000_msb[03] +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1A1 + LABEL- + FORMATTED-STORE s2, us_time_lsb + LOGFORMAT-STORE s2, us_time_lsb[02] +INSTRUCTION-STORE + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-us_time_lsb + OP2 VALUE-02 + COMMENT-;store the current value of 'us' + ADDRESS-1A2 + LABEL- + FORMATTED-STORE s3, us_time_msb + LOGFORMAT-STORE s3, us_time_msb[03] +INSTRUCTION-STORE + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-us_time_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1A3 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;s0 holds the number of 'ms' elapsed since last update (if any). + ADDRESS-1A3 + LABEL- + FORMATTED-FETCH s2, ms_time_lsb + LOGFORMAT-FETCH s2, ms_time_lsb[04] +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT-;read current 'ms' time into [s3,s2] + ADDRESS-1A4 + LABEL- + FORMATTED-FETCH s3, ms_time_msb + LOGFORMAT-FETCH s3, ms_time_msb[05] +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-1A5 + LABEL- + FORMATTED-ADD s2, s0 + LOGFORMAT-ADD s2, s0 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT-;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + ADDRESS-1A6 + LABEL- + FORMATTED-ADDCY s3, 00 + LOGFORMAT-ADDCY s3, 00 +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-1A7 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;determine if there are now more than 1000ms to form 1 second. + ADDRESS-1A7 + LABEL- + FORMATTED-LOAD s0, 00 + LOGFORMAT-LOAD s0, 00 +INSTRUCTION-LOAD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;reset 'second' counter + ADDRESS-1A8 + LABEL- + FORMATTED-SUB s2, count_1000_lsb + LOGFORMAT-SUB s2, count_1000_lsb[E8] +INSTRUCTION-SUB + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;subtract 1000 from [s3,s2] + ADDRESS-1A9 + LABEL- + FORMATTED-SUBCY s3, count_1000_msb + LOGFORMAT-SUBCY s3, count_1000_msb[03] +INSTRUCTION-SUBCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1AA + LABEL- + FORMATTED-JUMP C, restore_ms_time + LOGFORMAT-JUMP C, restore_ms_time[1AD] +INSTRUCTION-JUMP + OPERAND1-C + OP1 VALUE-C + OPERAND2-restore_ms_time + OP2 VALUE-1AD + COMMENT-;Carry indicates [s3,s2] was less than 1000ms + ADDRESS-1AB + LABEL- + FORMATTED-ADD s0, 01 + LOGFORMAT-ADD s0, 01 +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + ADDRESS-1AC + LABEL- + FORMATTED-JUMP store_ms_time + LOGFORMAT-JUMP store_ms_time[1AF] +INSTRUCTION-JUMP + OPERAND1-store_ms_time + OP1 VALUE-1AF + OPERAND2- + OP2 VALUE- + COMMENT-;new value of 'ms' is remainder of subtraction + ADDRESS-1AD + LABEL-restore_ms_time + FORMATTED-ADD s2, count_1000_lsb + LOGFORMAT-ADD s2, count_1000_lsb[E8] +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-count_1000_lsb + OP2 VALUE-E8 + COMMENT-;add 1000 to restore 'ms' value + ADDRESS-1AE + LABEL- + FORMATTED-ADDCY s3, count_1000_msb + LOGFORMAT-ADDCY s3, count_1000_msb[03] +INSTRUCTION-ADDCY + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-count_1000_msb + OP2 VALUE-03 + COMMENT- + ADDRESS-1AF + LABEL-store_ms_time + FORMATTED-STORE s2, ms_time_lsb + LOGFORMAT-STORE s2, ms_time_lsb[04] +INSTRUCTION-STORE + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-ms_time_lsb + OP2 VALUE-04 + COMMENT-;store the current value of 'ms' + ADDRESS-1B0 + LABEL- + FORMATTED-STORE s3, ms_time_msb + LOGFORMAT-STORE s3, ms_time_msb[05] +INSTRUCTION-STORE + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-ms_time_msb + OP2 VALUE-05 + COMMENT- + ADDRESS-1B1 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + ADDRESS-1B1 + LABEL- + FORMATTED-FETCH s1, real_time_seconds + LOGFORMAT-FETCH s1, real_time_seconds[08] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT-;read seconds + ADDRESS-1B2 + LABEL- + FORMATTED-ADD s1, s0 + LOGFORMAT-ADD s1, s0 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT-;add one second if required by s0 + ADDRESS-1B3 + LABEL- + FORMATTED-COMPARE s1, seconds_in_a_minute + LOGFORMAT-COMPARE s1, seconds_in_a_minute[3C] +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-seconds_in_a_minute + OP2 VALUE-3C + COMMENT-;test for 1 minute + ADDRESS-1B4 + LABEL- + FORMATTED-JUMP Z, inc_minutes + LOGFORMAT-JUMP Z, inc_minutes[1B7] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-inc_minutes + OP2 VALUE-1B7 + COMMENT- + ADDRESS-1B5 + LABEL- + FORMATTED-STORE s1, real_time_seconds + LOGFORMAT-STORE s1, real_time_seconds[08] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT-;store updated seconds + ADDRESS-1B6 + LABEL- + FORMATTED-JUMP time_update_complete + LOGFORMAT-JUMP time_update_complete[1C9] +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OP1 VALUE-1C9 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1B7 + LABEL-inc_minutes + FORMATTED-LOAD s1, 00 + LOGFORMAT-LOAD s1, 00 +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;seconds become zero + ADDRESS-1B8 + LABEL- + FORMATTED-STORE s1, real_time_seconds + LOGFORMAT-STORE s1, real_time_seconds[08] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT- + ADDRESS-1B9 + LABEL- + FORMATTED-FETCH s1, real_time_minutes + LOGFORMAT-FETCH s1, real_time_minutes[07] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT-;read minutes + ADDRESS-1BA + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment minutes + ADDRESS-1BB + LABEL- + FORMATTED-COMPARE s1, minutes_in_an_hour + LOGFORMAT-COMPARE s1, minutes_in_an_hour[3C] +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-minutes_in_an_hour + OP2 VALUE-3C + COMMENT-;test for 1 hour + ADDRESS-1BC + LABEL- + FORMATTED-JUMP Z, inc_hours + LOGFORMAT-JUMP Z, inc_hours[1BF] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-inc_hours + OP2 VALUE-1BF + COMMENT- + ADDRESS-1BD + LABEL- + FORMATTED-STORE s1, real_time_minutes + LOGFORMAT-STORE s1, real_time_minutes[07] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT-;store updated minutes + ADDRESS-1BE + LABEL- + FORMATTED-JUMP time_update_complete + LOGFORMAT-JUMP time_update_complete[1C9] +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OP1 VALUE-1C9 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1BF + LABEL-inc_hours + FORMATTED-LOAD s1, 00 + LOGFORMAT-LOAD s1, 00 +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;minutes become zero + ADDRESS-1C0 + LABEL- + FORMATTED-STORE s1, real_time_minutes + LOGFORMAT-STORE s1, real_time_minutes[07] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT- + ADDRESS-1C1 + LABEL- + FORMATTED-FETCH s1, real_time_hours + LOGFORMAT-FETCH s1, real_time_hours[06] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;read hours + ADDRESS-1C2 + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;increment hours + ADDRESS-1C3 + LABEL- + FORMATTED-COMPARE s1, hours_in_a_day + LOGFORMAT-COMPARE s1, hours_in_a_day[18] +INSTRUCTION-COMPARE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-hours_in_a_day + OP2 VALUE-18 + COMMENT-;test for 24 hours + ADDRESS-1C4 + LABEL- + FORMATTED-JUMP Z, reset_hours + LOGFORMAT-JUMP Z, reset_hours[1C7] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-reset_hours + OP2 VALUE-1C7 + COMMENT- + ADDRESS-1C5 + LABEL- + FORMATTED-STORE s1, real_time_hours + LOGFORMAT-STORE s1, real_time_hours[06] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT-;store updated hours + ADDRESS-1C6 + LABEL- + FORMATTED-JUMP time_update_complete + LOGFORMAT-JUMP time_update_complete[1C9] +INSTRUCTION-JUMP + OPERAND1-time_update_complete + OP1 VALUE-1C9 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1C7 + LABEL-reset_hours + FORMATTED-LOAD s1, 00 + LOGFORMAT-LOAD s1, 00 +INSTRUCTION-LOAD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-00 + OP2 VALUE-00 + COMMENT-;hours become zero + ADDRESS-1C8 + LABEL- + FORMATTED-STORE s1, real_time_hours + LOGFORMAT-STORE s1, real_time_hours[06] +INSTRUCTION-STORE + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT- + ADDRESS-1C9 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1C9 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;With the time updated, there is then a test for time=alarm time + ADDRESS-1C9 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1C9 + LABEL-time_update_complete + FORMATTED-FETCH s0, real_time_hours + LOGFORMAT-FETCH s0, real_time_hours[06] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_hours + OP2 VALUE-06 + COMMENT- + ADDRESS-1CA + LABEL- + FORMATTED-FETCH s1, alarm_time_hours + LOGFORMAT-FETCH s1, alarm_time_hours[09] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-alarm_time_hours + OP2 VALUE-09 + COMMENT-;compare hours + ADDRESS-1CB + LABEL- + FORMATTED-COMPARE s0, s1 + LOGFORMAT-COMPARE s0, s1 +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT- + ADDRESS-1CC + LABEL- + FORMATTED-JUMP NZ, finish_update + LOGFORMAT-JUMP NZ, finish_update[1DB] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT- + ADDRESS-1CD + LABEL- + FORMATTED-FETCH s0, real_time_minutes + LOGFORMAT-FETCH s0, real_time_minutes[07] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_minutes + OP2 VALUE-07 + COMMENT-;compare minutes + ADDRESS-1CE + LABEL- + FORMATTED-FETCH s1, alarm_time_minutes + LOGFORMAT-FETCH s1, alarm_time_minutes[0A] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-alarm_time_minutes + OP2 VALUE-0A + COMMENT- + ADDRESS-1CF + LABEL- + FORMATTED-COMPARE s0, s1 + LOGFORMAT-COMPARE s0, s1 +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT- + ADDRESS-1D0 + LABEL- + FORMATTED-JUMP NZ, finish_update + LOGFORMAT-JUMP NZ, finish_update[1DB] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT- + ADDRESS-1D1 + LABEL- + FORMATTED-FETCH s0, real_time_seconds + LOGFORMAT-FETCH s0, real_time_seconds[08] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-real_time_seconds + OP2 VALUE-08 + COMMENT-;compare seconds + ADDRESS-1D2 + LABEL- + FORMATTED-FETCH s1, alarm_time_seconds + LOGFORMAT-FETCH s1, alarm_time_seconds[0B] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-alarm_time_seconds + OP2 VALUE-0B + COMMENT- + ADDRESS-1D3 + LABEL- + FORMATTED-COMPARE s0, s1 + LOGFORMAT-COMPARE s0, s1 +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-s1 + OP2 VALUE-s1 + COMMENT- + ADDRESS-1D4 + LABEL- + FORMATTED-JUMP NZ, finish_update + LOGFORMAT-JUMP NZ, finish_update[1DB] +INSTRUCTION-JUMP + OPERAND1-NZ + OP1 VALUE-NZ + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT- + ADDRESS-1D5 + LABEL- + FORMATTED-FETCH s0, alarm_status + LOGFORMAT-FETCH s0, alarm_status[0C] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT-;test if alarm is turned on + ADDRESS-1D6 + LABEL- + FORMATTED-TEST s0, alarm_armed + LOGFORMAT-TEST s0, alarm_armed[02] +INSTRUCTION-TEST + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_armed + OP2 VALUE-02 + COMMENT- + ADDRESS-1D7 + LABEL- + FORMATTED-JUMP Z, finish_update + LOGFORMAT-JUMP Z, finish_update[1DB] +INSTRUCTION-JUMP + OPERAND1-Z + OP1 VALUE-Z + OPERAND2-finish_update + OP2 VALUE-1DB + COMMENT-;alarm was off + ADDRESS-1D8 + LABEL- + FORMATTED-OR s0, alarm_active + LOGFORMAT-OR s0, alarm_active[01] +INSTRUCTION-OR + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_active + OP2 VALUE-01 + COMMENT-;activate alarm + ADDRESS-1D9 + LABEL- + FORMATTED-STORE s0, alarm_status + LOGFORMAT-STORE s0, alarm_status[0C] +INSTRUCTION-STORE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-alarm_status + OP2 VALUE-0C + COMMENT- + ADDRESS-1DA + LABEL- + FORMATTED-CALL alarm_drive + LOGFORMAT-CALL alarm_drive[0A4] +INSTRUCTION-CALL + OPERAND1-alarm_drive + OP1 VALUE-0A4 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1DB + LABEL-finish_update + FORMATTED-FETCH s0, time_preserve0 + LOGFORMAT-FETCH s0, time_preserve0[10] +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-time_preserve0 + OP2 VALUE-10 + COMMENT-;restore the register contents + ADDRESS-1DC + LABEL- + FORMATTED-FETCH s1, time_preserve1 + LOGFORMAT-FETCH s1, time_preserve1[11] +INSTRUCTION-FETCH + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-time_preserve1 + OP2 VALUE-11 + COMMENT- + ADDRESS-1DD + LABEL- + FORMATTED-FETCH s2, time_preserve2 + LOGFORMAT-FETCH s2, time_preserve2[12] +INSTRUCTION-FETCH + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-time_preserve2 + OP2 VALUE-12 + COMMENT- + ADDRESS-1DE + LABEL- + FORMATTED-FETCH s3, time_preserve3 + LOGFORMAT-FETCH s3, time_preserve3[13] +INSTRUCTION-FETCH + OPERAND1-s3 + OP1 VALUE-s3 + OPERAND2-time_preserve3 + OP2 VALUE-13 + COMMENT- + ADDRESS-1DF + LABEL- + FORMATTED-FETCH s4, time_preserve4 + LOGFORMAT-FETCH s4, time_preserve4[14] +INSTRUCTION-FETCH + OPERAND1-s4 + OP1 VALUE-s4 + OPERAND2-time_preserve4 + OP2 VALUE-14 + COMMENT- + ADDRESS-1E0 + LABEL- + FORMATTED-FETCH s5, time_preserve5 + LOGFORMAT-FETCH s5, time_preserve5[15] +INSTRUCTION-FETCH + OPERAND1-s5 + OP1 VALUE-s5 + OPERAND2-time_preserve5 + OP2 VALUE-15 + COMMENT- + ADDRESS-1E1 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert character to upper case + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The character supplied in register s0. + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;If the character is in the range 'a' to 'z', it is converted + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;to the equivalent upper case character in the range 'A' to 'Z'. + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;All other characters remain unchanged. + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0. + ADDRESS-1E2 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E2 + LABEL-upper_case + FORMATTED-COMPARE s0, 61 + LOGFORMAT-COMPARE s0, 61 +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-61 + OP2 VALUE-61 + COMMENT-;eliminate character codes below 'a' (61 hex) + ADDRESS-1E3 + LABEL- + FORMATTED-RETURN C + LOGFORMAT-RETURN C +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E4 + LABEL- + FORMATTED-COMPARE s0, 7B + LOGFORMAT-COMPARE s0, 7B +INSTRUCTION-COMPARE + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-7B + OP2 VALUE-7B + COMMENT-;eliminate character codes above 'z' (7A hex) + ADDRESS-1E5 + LABEL- + FORMATTED-RETURN NC + LOGFORMAT-RETURN NC +INSTRUCTION-RETURN + OPERAND1-NC + OP1 VALUE-NC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E6 + LABEL- + FORMATTED-AND s0, DF + LOGFORMAT-AND s0, DF +INSTRUCTION-AND + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-DF + OP2 VALUE-DF + COMMENT-;mask bit5 to convert to upper case + ADDRESS-1E7 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Convert character '0' to '9' to numerical value in range 0 to 9 + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The character supplied in register s0. If the character is in the + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;range '0' to '9', it is converted to the equivalent decimal value. + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Characters not in the range '0' to '9' are signified by the return + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;with the CARRY flag set. + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0. + ADDRESS-1E8 + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1E8 + LABEL-1char_to_value + FORMATTED-ADD s0, C6 + LOGFORMAT-ADD s0, C6 +INSTRUCTION-ADD + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-C6 + OP2 VALUE-C6 + COMMENT-;reject character codes above '9' (39 hex) + ADDRESS-1E9 + LABEL- + FORMATTED-RETURN C + LOGFORMAT-RETURN C +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT-;carry flag is set + ADDRESS-1EA + LABEL- + FORMATTED-SUB s0, F6 + LOGFORMAT-SUB s0, F6 +INSTRUCTION-SUB + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-F6 + OP2 VALUE-F6 + COMMENT-;reject character codes below '0' (30 hex) + ADDRESS-1EB + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;carry is set if value not in range + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Determine the numerical value of a two character decimal string held in + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The string must be stored as in two consecutive memory locations and the + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;location of the first (tens) character supplied in the s1 register. + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The result is provided in register s2. Strings not using characters in the + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;range '0' to '9' are signified by the return with the CARRY flag set. + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Registers used s0, s1 and s2. + ADDRESS-1EC + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1EC + LABEL-2char_to_value + FORMATTED-FETCH s0, (s1) + LOGFORMAT-FETCH s0, (s1) +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT-;read 'tens' character + ADDRESS-1ED + LABEL- + FORMATTED-CALL 1char_to_value + LOGFORMAT-CALL 1char_to_value[1E8] +INSTRUCTION-CALL + OPERAND1-1char_to_value + OP1 VALUE-1E8 + OPERAND2- + OP2 VALUE- + COMMENT-;convert to numerical value + ADDRESS-1EE + LABEL- + FORMATTED-RETURN C + LOGFORMAT-RETURN C +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT-;bad character - CARRY set + ADDRESS-1EF + LABEL- + FORMATTED-LOAD s2, s0 + LOGFORMAT-LOAD s2, s0 +INSTRUCTION-LOAD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT- + ADDRESS-1F0 + LABEL- + FORMATTED-SL0 s2 + LOGFORMAT-SL0 s2 +INSTRUCTION-SL0 + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2- + OP2 VALUE- + COMMENT-;multiply 'tens' value by 10 (0A hex) + ADDRESS-1F1 + LABEL- + FORMATTED-SL0 s2 + LOGFORMAT-SL0 s2 +INSTRUCTION-SL0 + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1F2 + LABEL- + FORMATTED-ADD s2, s0 + LOGFORMAT-ADD s2, s0 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT- + ADDRESS-1F3 + LABEL- + FORMATTED-SL0 s2 + LOGFORMAT-SL0 s2 +INSTRUCTION-SL0 + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1F4 + LABEL- + FORMATTED-ADD s1, 01 + LOGFORMAT-ADD s1, 01 +INSTRUCTION-ADD + OPERAND1-s1 + OP1 VALUE-s1 + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;read 'units' character + ADDRESS-1F5 + LABEL- + FORMATTED-FETCH s0, (s1) + LOGFORMAT-FETCH s0, (s1) +INSTRUCTION-FETCH + OPERAND1-s0 + OP1 VALUE-s0 + OPERAND2-(s1) + OP2 VALUE-(s1) + COMMENT- + ADDRESS-1F6 + LABEL- + FORMATTED-CALL 1char_to_value + LOGFORMAT-CALL 1char_to_value[1E8] +INSTRUCTION-CALL + OPERAND1-1char_to_value + OP1 VALUE-1E8 + OPERAND2- + OP2 VALUE- + COMMENT-;convert to numerical value + ADDRESS-1F7 + LABEL- + FORMATTED-RETURN C + LOGFORMAT-RETURN C +INSTRUCTION-RETURN + OPERAND1-C + OP1 VALUE-C + OPERAND2- + OP2 VALUE- + COMMENT-;bad character - CARRY set + ADDRESS-1F8 + LABEL- + FORMATTED-ADD s2, s0 + LOGFORMAT-ADD s2, s0 +INSTRUCTION-ADD + OPERAND1-s2 + OP1 VALUE-s2 + OPERAND2-s0 + OP2 VALUE-s0 + COMMENT-;add units to result and clear CARRY flag + ADDRESS-1F9 + LABEL- + FORMATTED-RETURN + LOGFORMAT-RETURN +INSTRUCTION-RETURN + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Interrupt service routine (ISR) + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The interrupt is used to increment a 16-bit counter formed with two registers + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;of micro-seconds elapsed. The counter is 'free running' in that it will count + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;up to 65,535 and then roll over to zero. The count value is then used in other + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;parts of the program as required and where it is less time critical. + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;The ISR only uses the specified counter registers + ADDRESS-1FA + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FC + LABEL- + FORMATTED-ADDRESS 3FC + LOGFORMAT-ADDRESS 3FC +INSTRUCTION-ADDRESS + OPERAND1-3FC + OP1 VALUE-3FC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FC + LABEL-ISR + FORMATTED-ADD int_counter_lsb, 01 + LOGFORMAT-ADD int_counter_lsb[sD], 01 +INSTRUCTION-ADD + OPERAND1-int_counter_lsb + OP1 VALUE-sD + OPERAND2-01 + OP2 VALUE-01 + COMMENT-;add 1us to 16-bit counter + ADDRESS-3FD + LABEL- + FORMATTED-ADDCY int_counter_msb, 00 + LOGFORMAT-ADDCY int_counter_msb[sC], 00 +INSTRUCTION-ADDCY + OPERAND1-int_counter_msb + OP1 VALUE-sC + OPERAND2-00 + OP2 VALUE-00 + COMMENT- + ADDRESS-3FE + LABEL- + FORMATTED-RETURNI ENABLE + LOGFORMAT-RETURNI ENABLE +INSTRUCTION-RETURNI + OPERAND1-ENABLE + OP1 VALUE-ENABLE + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Interrupt vector + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED-ADDRESS 3FF + LOGFORMAT-ADDRESS 3FF +INSTRUCTION-ADDRESS + OPERAND1-3FF + OP1 VALUE-3FF + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-JUMP ISR + LOGFORMAT-JUMP ISR[3FC] +INSTRUCTION-JUMP + OPERAND1-ISR + OP1 VALUE-3FC + OPERAND2- + OP2 VALUE- + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;Useful constants + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-;ASCII table + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_a, 61 + LOGFORMAT-CONSTANT character_a, 61 +INSTRUCTION-CONSTANT + OPERAND1-character_a + OP1 VALUE-character_a + OPERAND2-61 + OP2 VALUE-61 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_b, 62 + LOGFORMAT-CONSTANT character_b, 62 +INSTRUCTION-CONSTANT + OPERAND1-character_b + OP1 VALUE-character_b + OPERAND2-62 + OP2 VALUE-62 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_c, 63 + LOGFORMAT-CONSTANT character_c, 63 +INSTRUCTION-CONSTANT + OPERAND1-character_c + OP1 VALUE-character_c + OPERAND2-63 + OP2 VALUE-63 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_d, 64 + LOGFORMAT-CONSTANT character_d, 64 +INSTRUCTION-CONSTANT + OPERAND1-character_d + OP1 VALUE-character_d + OPERAND2-64 + OP2 VALUE-64 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_e, 65 + LOGFORMAT-CONSTANT character_e, 65 +INSTRUCTION-CONSTANT + OPERAND1-character_e + OP1 VALUE-character_e + OPERAND2-65 + OP2 VALUE-65 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_f, 66 + LOGFORMAT-CONSTANT character_f, 66 +INSTRUCTION-CONSTANT + OPERAND1-character_f + OP1 VALUE-character_f + OPERAND2-66 + OP2 VALUE-66 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_g, 67 + LOGFORMAT-CONSTANT character_g, 67 +INSTRUCTION-CONSTANT + OPERAND1-character_g + OP1 VALUE-character_g + OPERAND2-67 + OP2 VALUE-67 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_h, 68 + LOGFORMAT-CONSTANT character_h, 68 +INSTRUCTION-CONSTANT + OPERAND1-character_h + OP1 VALUE-character_h + OPERAND2-68 + OP2 VALUE-68 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_i, 69 + LOGFORMAT-CONSTANT character_i, 69 +INSTRUCTION-CONSTANT + OPERAND1-character_i + OP1 VALUE-character_i + OPERAND2-69 + OP2 VALUE-69 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_j, 6A + LOGFORMAT-CONSTANT character_j, 6A +INSTRUCTION-CONSTANT + OPERAND1-character_j + OP1 VALUE-character_j + OPERAND2-6A + OP2 VALUE-6A + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_k, 6B + LOGFORMAT-CONSTANT character_k, 6B +INSTRUCTION-CONSTANT + OPERAND1-character_k + OP1 VALUE-character_k + OPERAND2-6B + OP2 VALUE-6B + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_l, 6C + LOGFORMAT-CONSTANT character_l, 6C +INSTRUCTION-CONSTANT + OPERAND1-character_l + OP1 VALUE-character_l + OPERAND2-6C + OP2 VALUE-6C + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_m, 6D + LOGFORMAT-CONSTANT character_m, 6D +INSTRUCTION-CONSTANT + OPERAND1-character_m + OP1 VALUE-character_m + OPERAND2-6D + OP2 VALUE-6D + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_n, 6E + LOGFORMAT-CONSTANT character_n, 6E +INSTRUCTION-CONSTANT + OPERAND1-character_n + OP1 VALUE-character_n + OPERAND2-6E + OP2 VALUE-6E + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_o, 6F + LOGFORMAT-CONSTANT character_o, 6F +INSTRUCTION-CONSTANT + OPERAND1-character_o + OP1 VALUE-character_o + OPERAND2-6F + OP2 VALUE-6F + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_p, 70 + LOGFORMAT-CONSTANT character_p, 70 +INSTRUCTION-CONSTANT + OPERAND1-character_p + OP1 VALUE-character_p + OPERAND2-70 + OP2 VALUE-70 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_q, 71 + LOGFORMAT-CONSTANT character_q, 71 +INSTRUCTION-CONSTANT + OPERAND1-character_q + OP1 VALUE-character_q + OPERAND2-71 + OP2 VALUE-71 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_r, 72 + LOGFORMAT-CONSTANT character_r, 72 +INSTRUCTION-CONSTANT + OPERAND1-character_r + OP1 VALUE-character_r + OPERAND2-72 + OP2 VALUE-72 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_s, 73 + LOGFORMAT-CONSTANT character_s, 73 +INSTRUCTION-CONSTANT + OPERAND1-character_s + OP1 VALUE-character_s + OPERAND2-73 + OP2 VALUE-73 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_t, 74 + LOGFORMAT-CONSTANT character_t, 74 +INSTRUCTION-CONSTANT + OPERAND1-character_t + OP1 VALUE-character_t + OPERAND2-74 + OP2 VALUE-74 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_u, 75 + LOGFORMAT-CONSTANT character_u, 75 +INSTRUCTION-CONSTANT + OPERAND1-character_u + OP1 VALUE-character_u + OPERAND2-75 + OP2 VALUE-75 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_v, 76 + LOGFORMAT-CONSTANT character_v, 76 +INSTRUCTION-CONSTANT + OPERAND1-character_v + OP1 VALUE-character_v + OPERAND2-76 + OP2 VALUE-76 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_w, 77 + LOGFORMAT-CONSTANT character_w, 77 +INSTRUCTION-CONSTANT + OPERAND1-character_w + OP1 VALUE-character_w + OPERAND2-77 + OP2 VALUE-77 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_x, 78 + LOGFORMAT-CONSTANT character_x, 78 +INSTRUCTION-CONSTANT + OPERAND1-character_x + OP1 VALUE-character_x + OPERAND2-78 + OP2 VALUE-78 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_y, 79 + LOGFORMAT-CONSTANT character_y, 79 +INSTRUCTION-CONSTANT + OPERAND1-character_y + OP1 VALUE-character_y + OPERAND2-79 + OP2 VALUE-79 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_z, 7A + LOGFORMAT-CONSTANT character_z, 7A +INSTRUCTION-CONSTANT + OPERAND1-character_z + OP1 VALUE-character_z + OPERAND2-7A + OP2 VALUE-7A + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_A, 41 + LOGFORMAT-CONSTANT character_A, 41 +INSTRUCTION-CONSTANT + OPERAND1-character_A + OP1 VALUE-character_A + OPERAND2-41 + OP2 VALUE-41 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_B, 42 + LOGFORMAT-CONSTANT character_B, 42 +INSTRUCTION-CONSTANT + OPERAND1-character_B + OP1 VALUE-character_B + OPERAND2-42 + OP2 VALUE-42 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_C, 43 + LOGFORMAT-CONSTANT character_C, 43 +INSTRUCTION-CONSTANT + OPERAND1-character_C + OP1 VALUE-character_C + OPERAND2-43 + OP2 VALUE-43 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_D, 44 + LOGFORMAT-CONSTANT character_D, 44 +INSTRUCTION-CONSTANT + OPERAND1-character_D + OP1 VALUE-character_D + OPERAND2-44 + OP2 VALUE-44 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_E, 45 + LOGFORMAT-CONSTANT character_E, 45 +INSTRUCTION-CONSTANT + OPERAND1-character_E + OP1 VALUE-character_E + OPERAND2-45 + OP2 VALUE-45 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_F, 46 + LOGFORMAT-CONSTANT character_F, 46 +INSTRUCTION-CONSTANT + OPERAND1-character_F + OP1 VALUE-character_F + OPERAND2-46 + OP2 VALUE-46 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_G, 47 + LOGFORMAT-CONSTANT character_G, 47 +INSTRUCTION-CONSTANT + OPERAND1-character_G + OP1 VALUE-character_G + OPERAND2-47 + OP2 VALUE-47 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_H, 48 + LOGFORMAT-CONSTANT character_H, 48 +INSTRUCTION-CONSTANT + OPERAND1-character_H + OP1 VALUE-character_H + OPERAND2-48 + OP2 VALUE-48 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_I, 49 + LOGFORMAT-CONSTANT character_I, 49 +INSTRUCTION-CONSTANT + OPERAND1-character_I + OP1 VALUE-character_I + OPERAND2-49 + OP2 VALUE-49 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_J, 4A + LOGFORMAT-CONSTANT character_J, 4A +INSTRUCTION-CONSTANT + OPERAND1-character_J + OP1 VALUE-character_J + OPERAND2-4A + OP2 VALUE-4A + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_K, 4B + LOGFORMAT-CONSTANT character_K, 4B +INSTRUCTION-CONSTANT + OPERAND1-character_K + OP1 VALUE-character_K + OPERAND2-4B + OP2 VALUE-4B + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_L, 4C + LOGFORMAT-CONSTANT character_L, 4C +INSTRUCTION-CONSTANT + OPERAND1-character_L + OP1 VALUE-character_L + OPERAND2-4C + OP2 VALUE-4C + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_M, 4D + LOGFORMAT-CONSTANT character_M, 4D +INSTRUCTION-CONSTANT + OPERAND1-character_M + OP1 VALUE-character_M + OPERAND2-4D + OP2 VALUE-4D + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_N, 4E + LOGFORMAT-CONSTANT character_N, 4E +INSTRUCTION-CONSTANT + OPERAND1-character_N + OP1 VALUE-character_N + OPERAND2-4E + OP2 VALUE-4E + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_O, 4F + LOGFORMAT-CONSTANT character_O, 4F +INSTRUCTION-CONSTANT + OPERAND1-character_O + OP1 VALUE-character_O + OPERAND2-4F + OP2 VALUE-4F + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_P, 50 + LOGFORMAT-CONSTANT character_P, 50 +INSTRUCTION-CONSTANT + OPERAND1-character_P + OP1 VALUE-character_P + OPERAND2-50 + OP2 VALUE-50 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_Q, 51 + LOGFORMAT-CONSTANT character_Q, 51 +INSTRUCTION-CONSTANT + OPERAND1-character_Q + OP1 VALUE-character_Q + OPERAND2-51 + OP2 VALUE-51 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_R, 52 + LOGFORMAT-CONSTANT character_R, 52 +INSTRUCTION-CONSTANT + OPERAND1-character_R + OP1 VALUE-character_R + OPERAND2-52 + OP2 VALUE-52 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_S, 53 + LOGFORMAT-CONSTANT character_S, 53 +INSTRUCTION-CONSTANT + OPERAND1-character_S + OP1 VALUE-character_S + OPERAND2-53 + OP2 VALUE-53 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_T, 54 + LOGFORMAT-CONSTANT character_T, 54 +INSTRUCTION-CONSTANT + OPERAND1-character_T + OP1 VALUE-character_T + OPERAND2-54 + OP2 VALUE-54 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_U, 55 + LOGFORMAT-CONSTANT character_U, 55 +INSTRUCTION-CONSTANT + OPERAND1-character_U + OP1 VALUE-character_U + OPERAND2-55 + OP2 VALUE-55 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_V, 56 + LOGFORMAT-CONSTANT character_V, 56 +INSTRUCTION-CONSTANT + OPERAND1-character_V + OP1 VALUE-character_V + OPERAND2-56 + OP2 VALUE-56 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_W, 57 + LOGFORMAT-CONSTANT character_W, 57 +INSTRUCTION-CONSTANT + OPERAND1-character_W + OP1 VALUE-character_W + OPERAND2-57 + OP2 VALUE-57 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_X, 58 + LOGFORMAT-CONSTANT character_X, 58 +INSTRUCTION-CONSTANT + OPERAND1-character_X + OP1 VALUE-character_X + OPERAND2-58 + OP2 VALUE-58 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_Y, 59 + LOGFORMAT-CONSTANT character_Y, 59 +INSTRUCTION-CONSTANT + OPERAND1-character_Y + OP1 VALUE-character_Y + OPERAND2-59 + OP2 VALUE-59 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_Z, 5A + LOGFORMAT-CONSTANT character_Z, 5A +INSTRUCTION-CONSTANT + OPERAND1-character_Z + OP1 VALUE-character_Z + OPERAND2-5A + OP2 VALUE-5A + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_0, 30 + LOGFORMAT-CONSTANT character_0, 30 +INSTRUCTION-CONSTANT + OPERAND1-character_0 + OP1 VALUE-character_0 + OPERAND2-30 + OP2 VALUE-30 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_1, 31 + LOGFORMAT-CONSTANT character_1, 31 +INSTRUCTION-CONSTANT + OPERAND1-character_1 + OP1 VALUE-character_1 + OPERAND2-31 + OP2 VALUE-31 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_2, 32 + LOGFORMAT-CONSTANT character_2, 32 +INSTRUCTION-CONSTANT + OPERAND1-character_2 + OP1 VALUE-character_2 + OPERAND2-32 + OP2 VALUE-32 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_3, 33 + LOGFORMAT-CONSTANT character_3, 33 +INSTRUCTION-CONSTANT + OPERAND1-character_3 + OP1 VALUE-character_3 + OPERAND2-33 + OP2 VALUE-33 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_4, 34 + LOGFORMAT-CONSTANT character_4, 34 +INSTRUCTION-CONSTANT + OPERAND1-character_4 + OP1 VALUE-character_4 + OPERAND2-34 + OP2 VALUE-34 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_5, 35 + LOGFORMAT-CONSTANT character_5, 35 +INSTRUCTION-CONSTANT + OPERAND1-character_5 + OP1 VALUE-character_5 + OPERAND2-35 + OP2 VALUE-35 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_6, 36 + LOGFORMAT-CONSTANT character_6, 36 +INSTRUCTION-CONSTANT + OPERAND1-character_6 + OP1 VALUE-character_6 + OPERAND2-36 + OP2 VALUE-36 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_7, 37 + LOGFORMAT-CONSTANT character_7, 37 +INSTRUCTION-CONSTANT + OPERAND1-character_7 + OP1 VALUE-character_7 + OPERAND2-37 + OP2 VALUE-37 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_8, 38 + LOGFORMAT-CONSTANT character_8, 38 +INSTRUCTION-CONSTANT + OPERAND1-character_8 + OP1 VALUE-character_8 + OPERAND2-38 + OP2 VALUE-38 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_9, 39 + LOGFORMAT-CONSTANT character_9, 39 +INSTRUCTION-CONSTANT + OPERAND1-character_9 + OP1 VALUE-character_9 + OPERAND2-39 + OP2 VALUE-39 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_colon, 3A + LOGFORMAT-CONSTANT character_colon, 3A +INSTRUCTION-CONSTANT + OPERAND1-character_colon + OP1 VALUE-character_colon + OPERAND2-3A + OP2 VALUE-3A + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_semi_colon, 3B + LOGFORMAT-CONSTANT character_semi_colon, 3B +INSTRUCTION-CONSTANT + OPERAND1-character_semi_colon + OP1 VALUE-character_semi_colon + OPERAND2-3B + OP2 VALUE-3B + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_less_than, 3C + LOGFORMAT-CONSTANT character_less_than, 3C +INSTRUCTION-CONSTANT + OPERAND1-character_less_than + OP1 VALUE-character_less_than + OPERAND2-3C + OP2 VALUE-3C + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_greater_than, 3E + LOGFORMAT-CONSTANT character_greater_than, 3E +INSTRUCTION-CONSTANT + OPERAND1-character_greater_than + OP1 VALUE-character_greater_than + OPERAND2-3E + OP2 VALUE-3E + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_equals, 3D + LOGFORMAT-CONSTANT character_equals, 3D +INSTRUCTION-CONSTANT + OPERAND1-character_equals + OP1 VALUE-character_equals + OPERAND2-3D + OP2 VALUE-3D + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_space, 20 + LOGFORMAT-CONSTANT character_space, 20 +INSTRUCTION-CONSTANT + OPERAND1-character_space + OP1 VALUE-character_space + OPERAND2-20 + OP2 VALUE-20 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_CR, 0D + LOGFORMAT-CONSTANT character_CR, 0D +INSTRUCTION-CONSTANT + OPERAND1-character_CR + OP1 VALUE-character_CR + OPERAND2-0D + OP2 VALUE-0D + COMMENT-;carriage return + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_question, 3F + LOGFORMAT-CONSTANT character_question, 3F +INSTRUCTION-CONSTANT + OPERAND1-character_question + OP1 VALUE-character_question + OPERAND2-3F + OP2 VALUE-3F + COMMENT-;'?' + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_dollar, 24 + LOGFORMAT-CONSTANT character_dollar, 24 +INSTRUCTION-CONSTANT + OPERAND1-character_dollar + OP1 VALUE-character_dollar + OPERAND2-24 + OP2 VALUE-24 + COMMENT- + ADDRESS-3FF + LABEL- + FORMATTED-CONSTANT character_BS, 08 + LOGFORMAT-CONSTANT character_BS, 08 +INSTRUCTION-CONSTANT + OPERAND1-character_BS + OP1 VALUE-character_BS + OPERAND2-08 + OP2 VALUE-08 + COMMENT-;Back Space command character + ADDRESS-3FF + LABEL- + FORMATTED- + LOGFORMAT- +INSTRUCTION- + OPERAND1- + OP1 VALUE- + OPERAND2- + OP2 VALUE- + COMMENT-; diff --git a/projects/PicoBlaze/ise/Assembler/ROM_form.coe b/projects/PicoBlaze/ise/Assembler/ROM_form.coe new file mode 100644 index 0000000..97d039b --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/ROM_form.coe @@ -0,0 +1,29 @@ +component_name={name}; +width_a=18; +depth_a=1024; +configuration_port_a=read_only; +port_a_enable_pin=false; +port_a_handshaking_pins=false; +port_a_register_inputs=false; +port_a_init_pin=false; +port_a_init_value=00000; +port_a_additional_output_pipe_stages = 0; +port_a_register_inputs = false; +port_a_active_clock_edge = Rising_Edge_Triggered; +width_b=18; +depth_b=1024; +configuration_port_b=read_and_write; +write_mode_port_b=read_after_write; +port_b_enable_pin=false; +port_b_handshaking_pins=false; +port_b_register_inputs=false; +port_b_init_pin=false; +port_b_init_value=00000; +port_b_additional_output_pipe_stages = 0; +port_b_register_inputs = false; +port_b_active_clock_edge = Rising_Edge_Triggered; +port_b_write_enable_polarity = Active_High; +memory_initialization_radix=16; +global_init_value=00000; +memory_initialization_vector= + diff --git a/projects/PicoBlaze/ise/Assembler/ROM_form.v b/projects/PicoBlaze/ise/Assembler/ROM_form.v new file mode 100644 index 0000000..6ce5dfe --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/ROM_form.v @@ -0,0 +1,350 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2004 Xilinx, Inc. +// All Rights Reserved +//////////////////////////////////////////////////////////////////////////////// +// ____ ____ +// / /\/ / +// /___/ \ / Vendor: Xilinx +// \ \ \/ Version: 1.02 +// \ \ Filename: ROM_form.v +// / / Date Last Modified: September 7 2004 +// /___/ /\ Date Created: July 2003 +// \ \ / \ +// \___\/\___\ +// +//Device: Xilinx +//Purpose: +// This is the Verilog template file for the KCPSM3 assembler. +// It is used to configure a Spartan-3, Virtex-II or Virtex-IIPRO block +// RAM to act as a single port program ROM. +// +// This Verilog file is not valid as input directly into a synthesis or +// simulation tool. The assembler will read this template and insert the +// data required to complete the definition of program ROM and write it out +// to a new '.v' file associated with the name of the original '.psm' file +// being assembled. +// +// This template can be modified to define alternative memory definitions +// such as dual port. However, you are responsible for ensuring the template +// is correct as the assembler does not perform any checking of the Verilog. +// +// The assembler identifies all text enclosed by {} characters, and replaces +// these character strings. All templates should include these {} character +// strings for the assembler to work correctly. +// +// This template defines a block RAM configured in 1024 x 18-bit single port +// mode and conneceted to act as a single port ROM. +// +//Reference: +// None +//Revision History: +// Rev 1.00 - jc - Converted to verilog, July 2003. +// Rev 1.01 - sus - Added text to confirm to Xilinx HDL std, August 4 2004. +// Rev 1.02 - njs - Added attributes for Synplicity August 5 2004. +// Rev 1.03 - sus - Added text to conform to Xilinx generated +// HDL spec, September 7 2004 +// +//////////////////////////////////////////////////////////////////////////////// +// Contact: e-mail picoblaze@xilinx.com +////////////////////////////////////////////////////////////////////////////////// +// +// Disclaimer: +// LIMITED WARRANTY AND DISCLAIMER. These designs are +// provided to you "as is". Xilinx and its licensors make and you +// receive no warranties or conditions, express, implied, +// statutory or otherwise, and Xilinx specifically disclaims any +// implied warranties of merchantability, non-infringement, or +// fitness for a particular purpose. Xilinx does not warrant that +// the functions contained in these designs will meet your +// requirements, or that the operation of these designs will be +// uninterrupted or error free, or that defects in the Designs +// will be corrected. Furthermore, Xilinx does not warrant or +// make any representations regarding use or the results of the +// use of the designs in terms of correctness, accuracy, +// reliability, or otherwise. +// +// LIMITATION OF LIABILITY. In no event will Xilinx or its +// licensors be liable for any loss of data, lost profits, cost +// or procurement of substitute goods or services, or for any +// special, incidental, consequential, or indirect damages +// arising from the use or operation of the designs or +// accompanying documentation, however caused and on any theory +// of liability. This limitation will apply even if Xilinx +// has been advised of the possibility of such damage. This +// limitation shall apply not-withstanding the failure of the +// essential purpose of any limited remedies herein. +////////////////////////////////////////////////////////////////////////////////// + +The next line is used to determine where the template actually starts and must exist. +{begin template} +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2004 Xilinx, Inc. +// All Rights Reserved +//////////////////////////////////////////////////////////////////////////////// +// ____ ____ +// / /\/ / +// /___/ \ / Vendor: Xilinx +// \ \ \/ Version: v1.30 +// \ \ Application : KCPSM3 +// / / Filename: {name}.v +// /___/ /\ +// \ \ / \ +// \___\/\___\ +// +//Command: kcpsm3 {name}.psm +//Device: Spartan-3, Spartan-3E, Virtex-II, and Virtex-II Pro FPGAs +//Design Name: {name} +//Generated {timestamp}. +//Purpose: +// {name} verilog program definition. +// +//Reference: +// PicoBlaze 8-bit Embedded Microcontroller User Guide +//////////////////////////////////////////////////////////////////////////////// + +`timescale 1 ps / 1ps + +module {name} (address, instruction, clk); + +input [9:0] address; +input clk; + +output [17:0] instruction; + +RAMB16_S18 ram_1024_x_18( + .DI (16'h0000), + .DIP (2'b00), + .EN (1'b1), + .WE (1'b0), + .SSR (1'b0), + .CLK (clk), + .ADDR (address), + .DO (instruction[15:0]), + .DOP (instruction[17:16])) +/*synthesis +init_00 = "{INIT_00}" +init_01 = "{INIT_01}" +init_02 = "{INIT_02}" +init_03 = "{INIT_03}" +init_04 = "{INIT_04}" +init_05 = "{INIT_05}" +init_06 = "{INIT_06}" +init_07 = "{INIT_07}" +init_08 = "{INIT_08}" +init_09 = "{INIT_09}" +init_0A = "{INIT_0A}" +init_0B = "{INIT_0B}" +init_0C = "{INIT_0C}" +init_0D = "{INIT_0D}" +init_0E = "{INIT_0E}" +init_0F = "{INIT_0F}" +init_10 = "{INIT_10}" +init_11 = "{INIT_11}" +init_12 = "{INIT_12}" +init_13 = "{INIT_13}" +init_14 = "{INIT_14}" +init_15 = "{INIT_15}" +init_16 = "{INIT_16}" +init_17 = "{INIT_17}" +init_18 = "{INIT_18}" +init_19 = "{INIT_19}" +init_1A = "{INIT_1A}" +init_1B = "{INIT_1B}" +init_1C = "{INIT_1C}" +init_1D = "{INIT_1D}" +init_1E = "{INIT_1E}" +init_1F = "{INIT_1F}" +init_20 = "{INIT_20}" +init_21 = "{INIT_21}" +init_22 = "{INIT_22}" +init_23 = "{INIT_23}" +init_24 = "{INIT_24}" +init_25 = "{INIT_25}" +init_26 = "{INIT_26}" +init_27 = "{INIT_27}" +init_28 = "{INIT_28}" +init_29 = "{INIT_29}" +init_2A = "{INIT_2A}" +init_2B = "{INIT_2B}" +init_2C = "{INIT_2C}" +init_2D = "{INIT_2D}" +init_2E = "{INIT_2E}" +init_2F = "{INIT_2F}" +init_30 = "{INIT_30}" +init_31 = "{INIT_31}" +init_32 = "{INIT_32}" +init_33 = "{INIT_33}" +init_34 = "{INIT_34}" +init_35 = "{INIT_35}" +init_36 = "{INIT_36}" +init_37 = "{INIT_37}" +init_38 = "{INIT_38}" +init_39 = "{INIT_39}" +init_3A = "{INIT_3A}" +init_3B = "{INIT_3B}" +init_3C = "{INIT_3C}" +init_3D = "{INIT_3D}" +init_3E = "{INIT_3E}" +init_3F = "{INIT_3F}" +initp_00 = "{INITP_00}" +initp_01 = "{INITP_01}" +initp_02 = "{INITP_02}" +initp_03 = "{INITP_03}" +initp_04 = "{INITP_04}" +initp_05 = "{INITP_05}" +initp_06 = "{INITP_06}" +initp_07 = "{INITP_07}" */; + +// synthesis translate_off +// Attributes for Simulation +defparam ram_1024_x_18.INIT_00 = 256'h{INIT_00}; +defparam ram_1024_x_18.INIT_01 = 256'h{INIT_01}; +defparam ram_1024_x_18.INIT_02 = 256'h{INIT_02}; +defparam ram_1024_x_18.INIT_03 = 256'h{INIT_03}; +defparam ram_1024_x_18.INIT_04 = 256'h{INIT_04}; +defparam ram_1024_x_18.INIT_05 = 256'h{INIT_05}; +defparam ram_1024_x_18.INIT_06 = 256'h{INIT_06}; +defparam ram_1024_x_18.INIT_07 = 256'h{INIT_07}; +defparam ram_1024_x_18.INIT_08 = 256'h{INIT_08}; +defparam ram_1024_x_18.INIT_09 = 256'h{INIT_09}; +defparam ram_1024_x_18.INIT_0A = 256'h{INIT_0A}; +defparam ram_1024_x_18.INIT_0B = 256'h{INIT_0B}; +defparam ram_1024_x_18.INIT_0C = 256'h{INIT_0C}; +defparam ram_1024_x_18.INIT_0D = 256'h{INIT_0D}; +defparam ram_1024_x_18.INIT_0E = 256'h{INIT_0E}; +defparam ram_1024_x_18.INIT_0F = 256'h{INIT_0F}; +defparam ram_1024_x_18.INIT_10 = 256'h{INIT_10}; +defparam ram_1024_x_18.INIT_11 = 256'h{INIT_11}; +defparam ram_1024_x_18.INIT_12 = 256'h{INIT_12}; +defparam ram_1024_x_18.INIT_13 = 256'h{INIT_13}; +defparam ram_1024_x_18.INIT_14 = 256'h{INIT_14}; +defparam ram_1024_x_18.INIT_15 = 256'h{INIT_15}; +defparam ram_1024_x_18.INIT_16 = 256'h{INIT_16}; +defparam ram_1024_x_18.INIT_17 = 256'h{INIT_17}; +defparam ram_1024_x_18.INIT_18 = 256'h{INIT_18}; +defparam ram_1024_x_18.INIT_19 = 256'h{INIT_19}; +defparam ram_1024_x_18.INIT_1A = 256'h{INIT_1A}; +defparam ram_1024_x_18.INIT_1B = 256'h{INIT_1B}; +defparam ram_1024_x_18.INIT_1C = 256'h{INIT_1C}; +defparam ram_1024_x_18.INIT_1D = 256'h{INIT_1D}; +defparam ram_1024_x_18.INIT_1E = 256'h{INIT_1E}; +defparam ram_1024_x_18.INIT_1F = 256'h{INIT_1F}; +defparam ram_1024_x_18.INIT_20 = 256'h{INIT_20}; +defparam ram_1024_x_18.INIT_21 = 256'h{INIT_21}; +defparam ram_1024_x_18.INIT_22 = 256'h{INIT_22}; +defparam ram_1024_x_18.INIT_23 = 256'h{INIT_23}; +defparam ram_1024_x_18.INIT_24 = 256'h{INIT_24}; +defparam ram_1024_x_18.INIT_25 = 256'h{INIT_25}; +defparam ram_1024_x_18.INIT_26 = 256'h{INIT_26}; +defparam ram_1024_x_18.INIT_27 = 256'h{INIT_27}; +defparam ram_1024_x_18.INIT_28 = 256'h{INIT_28}; +defparam ram_1024_x_18.INIT_29 = 256'h{INIT_29}; +defparam ram_1024_x_18.INIT_2A = 256'h{INIT_2A}; +defparam ram_1024_x_18.INIT_2B = 256'h{INIT_2B}; +defparam ram_1024_x_18.INIT_2C = 256'h{INIT_2C}; +defparam ram_1024_x_18.INIT_2D = 256'h{INIT_2D}; +defparam ram_1024_x_18.INIT_2E = 256'h{INIT_2E}; +defparam ram_1024_x_18.INIT_2F = 256'h{INIT_2F}; +defparam ram_1024_x_18.INIT_30 = 256'h{INIT_30}; +defparam ram_1024_x_18.INIT_31 = 256'h{INIT_31}; +defparam ram_1024_x_18.INIT_32 = 256'h{INIT_32}; +defparam ram_1024_x_18.INIT_33 = 256'h{INIT_33}; +defparam ram_1024_x_18.INIT_34 = 256'h{INIT_34}; +defparam ram_1024_x_18.INIT_35 = 256'h{INIT_35}; +defparam ram_1024_x_18.INIT_36 = 256'h{INIT_36}; +defparam ram_1024_x_18.INIT_37 = 256'h{INIT_37}; +defparam ram_1024_x_18.INIT_38 = 256'h{INIT_38}; +defparam ram_1024_x_18.INIT_39 = 256'h{INIT_39}; +defparam ram_1024_x_18.INIT_3A = 256'h{INIT_3A}; +defparam ram_1024_x_18.INIT_3B = 256'h{INIT_3B}; +defparam ram_1024_x_18.INIT_3C = 256'h{INIT_3C}; +defparam ram_1024_x_18.INIT_3D = 256'h{INIT_3D}; +defparam ram_1024_x_18.INIT_3E = 256'h{INIT_3E}; +defparam ram_1024_x_18.INIT_3F = 256'h{INIT_3F}; +defparam ram_1024_x_18.INITP_00 = 256'h{INITP_00}; +defparam ram_1024_x_18.INITP_01 = 256'h{INITP_01}; +defparam ram_1024_x_18.INITP_02 = 256'h{INITP_02}; +defparam ram_1024_x_18.INITP_03 = 256'h{INITP_03}; +defparam ram_1024_x_18.INITP_04 = 256'h{INITP_04}; +defparam ram_1024_x_18.INITP_05 = 256'h{INITP_05}; +defparam ram_1024_x_18.INITP_06 = 256'h{INITP_06}; +defparam ram_1024_x_18.INITP_07 = 256'h{INITP_07}; + +// synthesis translate_on +// Attributes for XST (Synplicity attributes are in-line) +// synthesis attribute INIT_00 of ram_1024_x_18 is "{INIT_00}" +// synthesis attribute INIT_01 of ram_1024_x_18 is "{INIT_01}" +// synthesis attribute INIT_02 of ram_1024_x_18 is "{INIT_02}" +// synthesis attribute INIT_03 of ram_1024_x_18 is "{INIT_03}" +// synthesis attribute INIT_04 of ram_1024_x_18 is "{INIT_04}" +// synthesis attribute INIT_05 of ram_1024_x_18 is "{INIT_05}" +// synthesis attribute INIT_06 of ram_1024_x_18 is "{INIT_06}" +// synthesis attribute INIT_07 of ram_1024_x_18 is "{INIT_07}" +// synthesis attribute INIT_08 of ram_1024_x_18 is "{INIT_08}" +// synthesis attribute INIT_09 of ram_1024_x_18 is "{INIT_09}" +// synthesis attribute INIT_0A of ram_1024_x_18 is "{INIT_0A}" +// synthesis attribute INIT_0B of ram_1024_x_18 is "{INIT_0B}" +// synthesis attribute INIT_0C of ram_1024_x_18 is "{INIT_0C}" +// synthesis attribute INIT_0D of ram_1024_x_18 is "{INIT_0D}" +// synthesis attribute INIT_0E of ram_1024_x_18 is "{INIT_0E}" +// synthesis attribute INIT_0F of ram_1024_x_18 is "{INIT_0F}" +// synthesis attribute INIT_10 of ram_1024_x_18 is "{INIT_10}" +// synthesis attribute INIT_11 of ram_1024_x_18 is "{INIT_11}" +// synthesis attribute INIT_12 of ram_1024_x_18 is "{INIT_12}" +// synthesis attribute INIT_13 of ram_1024_x_18 is "{INIT_13}" +// synthesis attribute INIT_14 of ram_1024_x_18 is "{INIT_14}" +// synthesis attribute INIT_15 of ram_1024_x_18 is "{INIT_15}" +// synthesis attribute INIT_16 of ram_1024_x_18 is "{INIT_16}" +// synthesis attribute INIT_17 of ram_1024_x_18 is "{INIT_17}" +// synthesis attribute INIT_18 of ram_1024_x_18 is "{INIT_18}" +// synthesis attribute INIT_19 of ram_1024_x_18 is "{INIT_19}" +// synthesis attribute INIT_1A of ram_1024_x_18 is "{INIT_1A}" +// synthesis attribute INIT_1B of ram_1024_x_18 is "{INIT_1B}" +// synthesis attribute INIT_1C of ram_1024_x_18 is "{INIT_1C}" +// synthesis attribute INIT_1D of ram_1024_x_18 is "{INIT_1D}" +// synthesis attribute INIT_1E of ram_1024_x_18 is "{INIT_1E}" +// synthesis attribute INIT_1F of ram_1024_x_18 is "{INIT_1F}" +// synthesis attribute INIT_20 of ram_1024_x_18 is "{INIT_20}" +// synthesis attribute INIT_21 of ram_1024_x_18 is "{INIT_21}" +// synthesis attribute INIT_22 of ram_1024_x_18 is "{INIT_22}" +// synthesis attribute INIT_23 of ram_1024_x_18 is "{INIT_23}" +// synthesis attribute INIT_24 of ram_1024_x_18 is "{INIT_24}" +// synthesis attribute INIT_25 of ram_1024_x_18 is "{INIT_25}" +// synthesis attribute INIT_26 of ram_1024_x_18 is "{INIT_26}" +// synthesis attribute INIT_27 of ram_1024_x_18 is "{INIT_27}" +// synthesis attribute INIT_28 of ram_1024_x_18 is "{INIT_28}" +// synthesis attribute INIT_29 of ram_1024_x_18 is "{INIT_29}" +// synthesis attribute INIT_2A of ram_1024_x_18 is "{INIT_2A}" +// synthesis attribute INIT_2B of ram_1024_x_18 is "{INIT_2B}" +// synthesis attribute INIT_2C of ram_1024_x_18 is "{INIT_2C}" +// synthesis attribute INIT_2D of ram_1024_x_18 is "{INIT_2D}" +// synthesis attribute INIT_2E of ram_1024_x_18 is "{INIT_2E}" +// synthesis attribute INIT_2F of ram_1024_x_18 is "{INIT_2F}" +// synthesis attribute INIT_30 of ram_1024_x_18 is "{INIT_30}" +// synthesis attribute INIT_31 of ram_1024_x_18 is "{INIT_31}" +// synthesis attribute INIT_32 of ram_1024_x_18 is "{INIT_32}" +// synthesis attribute INIT_33 of ram_1024_x_18 is "{INIT_33}" +// synthesis attribute INIT_34 of ram_1024_x_18 is "{INIT_34}" +// synthesis attribute INIT_35 of ram_1024_x_18 is "{INIT_35}" +// synthesis attribute INIT_36 of ram_1024_x_18 is "{INIT_36}" +// synthesis attribute INIT_37 of ram_1024_x_18 is "{INIT_37}" +// synthesis attribute INIT_38 of ram_1024_x_18 is "{INIT_38}" +// synthesis attribute INIT_39 of ram_1024_x_18 is "{INIT_39}" +// synthesis attribute INIT_3A of ram_1024_x_18 is "{INIT_3A}" +// synthesis attribute INIT_3B of ram_1024_x_18 is "{INIT_3B}" +// synthesis attribute INIT_3C of ram_1024_x_18 is "{INIT_3C}" +// synthesis attribute INIT_3D of ram_1024_x_18 is "{INIT_3D}" +// synthesis attribute INIT_3E of ram_1024_x_18 is "{INIT_3E}" +// synthesis attribute INIT_3F of ram_1024_x_18 is "{INIT_3F}" +// synthesis attribute INITP_00 of ram_1024_x_18 is "{INITP_00}" +// synthesis attribute INITP_01 of ram_1024_x_18 is "{INITP_01}" +// synthesis attribute INITP_02 of ram_1024_x_18 is "{INITP_02}" +// synthesis attribute INITP_03 of ram_1024_x_18 is "{INITP_03}" +// synthesis attribute INITP_04 of ram_1024_x_18 is "{INITP_04}" +// synthesis attribute INITP_05 of ram_1024_x_18 is "{INITP_05}" +// synthesis attribute INITP_06 of ram_1024_x_18 is "{INITP_06}" +// synthesis attribute INITP_07 of ram_1024_x_18 is "{INITP_07}" + +endmodule + +// END OF FILE {name}.v \ No newline at end of file diff --git a/projects/PicoBlaze/ise/Assembler/ROM_form.vhd b/projects/PicoBlaze/ise/Assembler/ROM_form.vhd new file mode 100644 index 0000000..6b1ce36 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/ROM_form.vhd @@ -0,0 +1,305 @@ +ROM_form.vhd + +Ken Chapman (Xilinx Ltd) July 2003 + +This is the VHDL template file for the KCPSM3 assembler. +It is used to configure a Spartan-3, Virtex-II or Virtex-IIPRO block RAM to act as +a single port program ROM. + +This VHDL file is not valid as input directly into a synthesis or simulation tool. +The assembler will read this template and insert the data required to complete the +definition of program ROM and write it out to a new '.vhd' file associated with the +name of the original '.psm' file being assembled. + +This template can be modified to define alternative memory definitions such as dual port. +However, you are responsible for ensuring the template is correct as the assembler does +not perform any checking of the VHDL. + +The assembler identifies all text enclosed by {} characters, and replaces these +character strings. All templates should include these {} character strings for +the assembler to work correctly. + +**************************************************************************************** + +This template defines a block RAM configured in 1024 x 18-bit single port mode and +conneceted to act as a single port ROM. + +**************************************************************************************** + +The next line is used to determine where the template actually starts and must exist. +{begin template} +-- +-- Definition of a single port ROM for KCPSM3 program defined by {name}.psm +-- +-- Generated by KCPSM3 Assembler {timestamp}. +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library unisim; +use unisim.vcomponents.all; +-- +-- +entity {name} is + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end {name}; +-- +architecture low_level_definition of {name} is +-- +-- Attributes to define ROM contents during implementation synthesis. +-- The information is repeated in the generic map for functional simulation +-- +attribute INIT_00 : string; +attribute INIT_01 : string; +attribute INIT_02 : string; +attribute INIT_03 : string; +attribute INIT_04 : string; +attribute INIT_05 : string; +attribute INIT_06 : string; +attribute INIT_07 : string; +attribute INIT_08 : string; +attribute INIT_09 : string; +attribute INIT_0A : string; +attribute INIT_0B : string; +attribute INIT_0C : string; +attribute INIT_0D : string; +attribute INIT_0E : string; +attribute INIT_0F : string; +attribute INIT_10 : string; +attribute INIT_11 : string; +attribute INIT_12 : string; +attribute INIT_13 : string; +attribute INIT_14 : string; +attribute INIT_15 : string; +attribute INIT_16 : string; +attribute INIT_17 : string; +attribute INIT_18 : string; +attribute INIT_19 : string; +attribute INIT_1A : string; +attribute INIT_1B : string; +attribute INIT_1C : string; +attribute INIT_1D : string; +attribute INIT_1E : string; +attribute INIT_1F : string; +attribute INIT_20 : string; +attribute INIT_21 : string; +attribute INIT_22 : string; +attribute INIT_23 : string; +attribute INIT_24 : string; +attribute INIT_25 : string; +attribute INIT_26 : string; +attribute INIT_27 : string; +attribute INIT_28 : string; +attribute INIT_29 : string; +attribute INIT_2A : string; +attribute INIT_2B : string; +attribute INIT_2C : string; +attribute INIT_2D : string; +attribute INIT_2E : string; +attribute INIT_2F : string; +attribute INIT_30 : string; +attribute INIT_31 : string; +attribute INIT_32 : string; +attribute INIT_33 : string; +attribute INIT_34 : string; +attribute INIT_35 : string; +attribute INIT_36 : string; +attribute INIT_37 : string; +attribute INIT_38 : string; +attribute INIT_39 : string; +attribute INIT_3A : string; +attribute INIT_3B : string; +attribute INIT_3C : string; +attribute INIT_3D : string; +attribute INIT_3E : string; +attribute INIT_3F : string; +attribute INITP_00 : string; +attribute INITP_01 : string; +attribute INITP_02 : string; +attribute INITP_03 : string; +attribute INITP_04 : string; +attribute INITP_05 : string; +attribute INITP_06 : string; +attribute INITP_07 : string; +-- +-- Attributes to define ROM contents during implementation synthesis. +-- +attribute INIT_00 of ram_1024_x_18 : label is "{INIT_00}"; +attribute INIT_01 of ram_1024_x_18 : label is "{INIT_01}"; +attribute INIT_02 of ram_1024_x_18 : label is "{INIT_02}"; +attribute INIT_03 of ram_1024_x_18 : label is "{INIT_03}"; +attribute INIT_04 of ram_1024_x_18 : label is "{INIT_04}"; +attribute INIT_05 of ram_1024_x_18 : label is "{INIT_05}"; +attribute INIT_06 of ram_1024_x_18 : label is "{INIT_06}"; +attribute INIT_07 of ram_1024_x_18 : label is "{INIT_07}"; +attribute INIT_08 of ram_1024_x_18 : label is "{INIT_08}"; +attribute INIT_09 of ram_1024_x_18 : label is "{INIT_09}"; +attribute INIT_0A of ram_1024_x_18 : label is "{INIT_0A}"; +attribute INIT_0B of ram_1024_x_18 : label is "{INIT_0B}"; +attribute INIT_0C of ram_1024_x_18 : label is "{INIT_0C}"; +attribute INIT_0D of ram_1024_x_18 : label is "{INIT_0D}"; +attribute INIT_0E of ram_1024_x_18 : label is "{INIT_0E}"; +attribute INIT_0F of ram_1024_x_18 : label is "{INIT_0F}"; +attribute INIT_10 of ram_1024_x_18 : label is "{INIT_10}"; +attribute INIT_11 of ram_1024_x_18 : label is "{INIT_11}"; +attribute INIT_12 of ram_1024_x_18 : label is "{INIT_12}"; +attribute INIT_13 of ram_1024_x_18 : label is "{INIT_13}"; +attribute INIT_14 of ram_1024_x_18 : label is "{INIT_14}"; +attribute INIT_15 of ram_1024_x_18 : label is "{INIT_15}"; +attribute INIT_16 of ram_1024_x_18 : label is "{INIT_16}"; +attribute INIT_17 of ram_1024_x_18 : label is "{INIT_17}"; +attribute INIT_18 of ram_1024_x_18 : label is "{INIT_18}"; +attribute INIT_19 of ram_1024_x_18 : label is "{INIT_19}"; +attribute INIT_1A of ram_1024_x_18 : label is "{INIT_1A}"; +attribute INIT_1B of ram_1024_x_18 : label is "{INIT_1B}"; +attribute INIT_1C of ram_1024_x_18 : label is "{INIT_1C}"; +attribute INIT_1D of ram_1024_x_18 : label is "{INIT_1D}"; +attribute INIT_1E of ram_1024_x_18 : label is "{INIT_1E}"; +attribute INIT_1F of ram_1024_x_18 : label is "{INIT_1F}"; +attribute INIT_20 of ram_1024_x_18 : label is "{INIT_20}"; +attribute INIT_21 of ram_1024_x_18 : label is "{INIT_21}"; +attribute INIT_22 of ram_1024_x_18 : label is "{INIT_22}"; +attribute INIT_23 of ram_1024_x_18 : label is "{INIT_23}"; +attribute INIT_24 of ram_1024_x_18 : label is "{INIT_24}"; +attribute INIT_25 of ram_1024_x_18 : label is "{INIT_25}"; +attribute INIT_26 of ram_1024_x_18 : label is "{INIT_26}"; +attribute INIT_27 of ram_1024_x_18 : label is "{INIT_27}"; +attribute INIT_28 of ram_1024_x_18 : label is "{INIT_28}"; +attribute INIT_29 of ram_1024_x_18 : label is "{INIT_29}"; +attribute INIT_2A of ram_1024_x_18 : label is "{INIT_2A}"; +attribute INIT_2B of ram_1024_x_18 : label is "{INIT_2B}"; +attribute INIT_2C of ram_1024_x_18 : label is "{INIT_2C}"; +attribute INIT_2D of ram_1024_x_18 : label is "{INIT_2D}"; +attribute INIT_2E of ram_1024_x_18 : label is "{INIT_2E}"; +attribute INIT_2F of ram_1024_x_18 : label is "{INIT_2F}"; +attribute INIT_30 of ram_1024_x_18 : label is "{INIT_30}"; +attribute INIT_31 of ram_1024_x_18 : label is "{INIT_31}"; +attribute INIT_32 of ram_1024_x_18 : label is "{INIT_32}"; +attribute INIT_33 of ram_1024_x_18 : label is "{INIT_33}"; +attribute INIT_34 of ram_1024_x_18 : label is "{INIT_34}"; +attribute INIT_35 of ram_1024_x_18 : label is "{INIT_35}"; +attribute INIT_36 of ram_1024_x_18 : label is "{INIT_36}"; +attribute INIT_37 of ram_1024_x_18 : label is "{INIT_37}"; +attribute INIT_38 of ram_1024_x_18 : label is "{INIT_38}"; +attribute INIT_39 of ram_1024_x_18 : label is "{INIT_39}"; +attribute INIT_3A of ram_1024_x_18 : label is "{INIT_3A}"; +attribute INIT_3B of ram_1024_x_18 : label is "{INIT_3B}"; +attribute INIT_3C of ram_1024_x_18 : label is "{INIT_3C}"; +attribute INIT_3D of ram_1024_x_18 : label is "{INIT_3D}"; +attribute INIT_3E of ram_1024_x_18 : label is "{INIT_3E}"; +attribute INIT_3F of ram_1024_x_18 : label is "{INIT_3F}"; +attribute INITP_00 of ram_1024_x_18 : label is "{INITP_00}"; +attribute INITP_01 of ram_1024_x_18 : label is "{INITP_01}"; +attribute INITP_02 of ram_1024_x_18 : label is "{INITP_02}"; +attribute INITP_03 of ram_1024_x_18 : label is "{INITP_03}"; +attribute INITP_04 of ram_1024_x_18 : label is "{INITP_04}"; +attribute INITP_05 of ram_1024_x_18 : label is "{INITP_05}"; +attribute INITP_06 of ram_1024_x_18 : label is "{INITP_06}"; +attribute INITP_07 of ram_1024_x_18 : label is "{INITP_07}"; +-- +begin +-- + --Instantiate the Xilinx primitive for a block RAM + ram_1024_x_18: RAMB16_S18 + --synthesis translate_off + --INIT values repeated to define contents for functional simulation + generic map ( INIT_00 => X"{INIT_00}", + INIT_01 => X"{INIT_01}", + INIT_02 => X"{INIT_02}", + INIT_03 => X"{INIT_03}", + INIT_04 => X"{INIT_04}", + INIT_05 => X"{INIT_05}", + INIT_06 => X"{INIT_06}", + INIT_07 => X"{INIT_07}", + INIT_08 => X"{INIT_08}", + INIT_09 => X"{INIT_09}", + INIT_0A => X"{INIT_0A}", + INIT_0B => X"{INIT_0B}", + INIT_0C => X"{INIT_0C}", + INIT_0D => X"{INIT_0D}", + INIT_0E => X"{INIT_0E}", + INIT_0F => X"{INIT_0F}", + INIT_10 => X"{INIT_10}", + INIT_11 => X"{INIT_11}", + INIT_12 => X"{INIT_12}", + INIT_13 => X"{INIT_13}", + INIT_14 => X"{INIT_14}", + INIT_15 => X"{INIT_15}", + INIT_16 => X"{INIT_16}", + INIT_17 => X"{INIT_17}", + INIT_18 => X"{INIT_18}", + INIT_19 => X"{INIT_19}", + INIT_1A => X"{INIT_1A}", + INIT_1B => X"{INIT_1B}", + INIT_1C => X"{INIT_1C}", + INIT_1D => X"{INIT_1D}", + INIT_1E => X"{INIT_1E}", + INIT_1F => X"{INIT_1F}", + INIT_20 => X"{INIT_20}", + INIT_21 => X"{INIT_21}", + INIT_22 => X"{INIT_22}", + INIT_23 => X"{INIT_23}", + INIT_24 => X"{INIT_24}", + INIT_25 => X"{INIT_25}", + INIT_26 => X"{INIT_26}", + INIT_27 => X"{INIT_27}", + INIT_28 => X"{INIT_28}", + INIT_29 => X"{INIT_29}", + INIT_2A => X"{INIT_2A}", + INIT_2B => X"{INIT_2B}", + INIT_2C => X"{INIT_2C}", + INIT_2D => X"{INIT_2D}", + INIT_2E => X"{INIT_2E}", + INIT_2F => X"{INIT_2F}", + INIT_30 => X"{INIT_30}", + INIT_31 => X"{INIT_31}", + INIT_32 => X"{INIT_32}", + INIT_33 => X"{INIT_33}", + INIT_34 => X"{INIT_34}", + INIT_35 => X"{INIT_35}", + INIT_36 => X"{INIT_36}", + INIT_37 => X"{INIT_37}", + INIT_38 => X"{INIT_38}", + INIT_39 => X"{INIT_39}", + INIT_3A => X"{INIT_3A}", + INIT_3B => X"{INIT_3B}", + INIT_3C => X"{INIT_3C}", + INIT_3D => X"{INIT_3D}", + INIT_3E => X"{INIT_3E}", + INIT_3F => X"{INIT_3F}", + INITP_00 => X"{INITP_00}", + INITP_01 => X"{INITP_01}", + INITP_02 => X"{INITP_02}", + INITP_03 => X"{INITP_03}", + INITP_04 => X"{INITP_04}", + INITP_05 => X"{INITP_05}", + INITP_06 => X"{INITP_06}", + INITP_07 => X"{INITP_07}") + --synthesis translate_on + port map( DI => "0000000000000000", + DIP => "00", + EN => '1', + WE => '0', + SSR => '0', + CLK => clk, + ADDR => address, + DO => instruction(15 downto 0), + DOP => instruction(17 downto 16)); +-- +end low_level_definition; +-- +------------------------------------------------------------------------------------ +-- +-- END OF FILE {name}.vhd +-- +------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.COE b/projects/PicoBlaze/ise/Assembler/UCLOCK.COE new file mode 100644 index 0000000..2447647 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.COE @@ -0,0 +1,92 @@ +component_name=uclock; +width_a=18; +depth_a=1024; +configuration_port_a=read_only; +port_a_enable_pin=false; +port_a_handshaking_pins=false; +port_a_register_inputs=false; +port_a_init_pin=false; +port_a_init_value=00000; +port_a_additional_output_pipe_stages = 0; +port_a_register_inputs = false; +port_a_active_clock_edge = Rising_Edge_Triggered; +width_b=18; +depth_b=1024; +configuration_port_b=read_and_write; +write_mode_port_b=read_after_write; +port_b_enable_pin=false; +port_b_handshaking_pins=false; +port_b_register_inputs=false; +port_b_init_pin=false; +port_b_init_value=00000; +port_b_additional_output_pipe_stages = 0; +port_b_register_inputs = false; +port_b_active_clock_edge = Rising_Edge_Triggered; +port_b_write_enable_polarity = Active_High; +memory_initialization_radix=16; +global_init_value=00000; +memory_initialization_vector= +00000, 2E000, 2E001, 2E002, 2E003, 2E004, 2E005, 2E006, 2E007, 2E008, 2E009, 2E00A, 2E00B, 2E00C, 300A4, 00D00, +00C00, 3C001, 30115, 300C3, 00120, 30091, 1400D, 35012, 14054, 3501E, 14041, 35037, 300ED, 35012, 30091, 14049, +3541C, 30091, 1404D, 3541C, 30091, 14045, 3541C, 30091, 1400D, 3542C, 300A8, 34012, 14020, 3541C, 3006D, 35812, +2E606, 2E507, 2E408, 2E004, 2E005, 300A8, 34012, 30091, 1404C, 3541C, 30091, 14041, 3541C, 30091, 14052, 3541C, +30091, 1404D, 3541C, 30091, 1400D, 35448, 300AC, 34012, 14020, 3541C, 30091, 1404F, 35055, 1C101, 3006D, 35812, +2E609, 2E50A, 2E40B, 300AC, 34012, 30091, 1404E, 35460, 30091, 1400D, 3541C, 0600C, 0C002, 2E00C, 300AC, 34012, +14046, 3541C, 30091, 14046, 3541C, 30091, 1400D, 3541C, 00000, 2E00C, 300A4, 300AC, 34012, 301EC, 3588B, 01620, +18101, 30091, 1403A, 3548B, 301EC, 3588B, 01520, 18101, 30091, 1403A, 3548B, 301EC, 3588B, 01420, 18101, 30091, +1400D, 3548B, 14618, 35C8B, 1453C, 35C8B, 1443C, 35C8B, 00000, 2000E, 2A000, 30125, 300E7, 30134, 00001, 2000E, +2A000, 07010, 301E2, 18101, 2A000, 04000, 12010, 3549A, 30185, 34095, 04F01, 3009D, 2A000, 04000, 12002, 350A2, +30185, 3409D, 2CF01, 2A000, 0600C, 0A001, 2C000, 2A000, 00E06, 30160, 300BC, 2A000, 00E09, 30160, 300BC, 3013D, +300E7, 0600C, 12001, 350B6, 30153, 2A000, 12002, 350BA, 3014E, 2A000, 30148, 2A000, 00120, 07F10, 3009D, 14F0D, +2B000, 18101, 340BD, 00120, 01210, 18210, 04000, 12008, 354DB, 30095, 2FF10, 14F0D, 2B000, 14F08, 350D3, 18101, +15120, 354C6, 300EA, 1C101, 14120, 358D9, 300E7, 300EA, 340C6, 30122, 340C3, 300E4, 2EF20, 300FA, 300E4, 04000, +12010, 2B000, 04F01, 340DF, 00F0D, 3009D, 2A000, 00F20, 3009D, 2A000, 00F08, 3009D, 2A000, 00F53, 3009D, 00F79, +3009D, 00F6E, 3009D, 00F74, 3009D, 00F61, 3009D, 00F78, 3009D, 3410A, 00F4F, 3009D, 00F76, 3009D, 00F65, 3009D, +00F72, 3009D, 00F66, 3009D, 00F6C, 3009D, 00F6F, 3009D, 00F77, 3009D, 300E7, 00F45, 3009D, 00F72, 3009D, 3009D, +00F6F, 3009D, 00F72, 3009D, 2A000, 300E4, 00F4B, 3009D, 00F43, 3009D, 00F50, 3009D, 00F53, 3009D, 00F4D, 3009D, +00F33, 3009D, 00F3E, 3009D, 2A000, 00F49, 3009D, 00F6E, 3009D, 00F76, 3009D, 00F61, 3009D, 00F6C, 3009D, 00F69, +3009D, 00F64, 3009D, 2A000, 00F54, 3009D, 00F69, 3009D, 00F6D, 3009D, 00F65, 3009D, 2A000, 00F41, 3009D, 00F6C, +3009D, 00F61, 3009D, 00F72, 3009D, 00F6D, 3009D, 2A000, 00F4F, 3009D, 00F46, 3009D, 3009D, 2A000, 00F4F, 3009D, +00F4E, 3009D, 2A000, 00F41, 3009D, 00F63, 3009D, 00F74, 3009D, 00F69, 3009D, 00F76, 3009D, 00F65, 3009D, 2A000, +00220, 070E0, 3017E, 2F120, 18201, 2F020, 18201, 0003A, 2F020, 18201, 18E01, 070E0, 3017E, 2F120, 18201, 2F020, +18201, 0003A, 2F020, 18201, 18E01, 070E0, 3017E, 2F120, 18201, 2F020, 18201, 0000D, 2F020, 2A000, 00130, 18101, +1C00A, 35D7F, 1C101, 1803A, 2A000, 2E010, 2E111, 2E212, 2E313, 2E414, 2E515, 06200, 06301, 3C000, 2ED00, 2EC01, +3C001, 06400, 06501, 1D420, 1F530, 06202, 06303, 19240, 1B350, 00000, 1C2E8, 1E303, 3599F, 18001, 3419A, 182E8, +1A303, 2E202, 2E303, 06204, 06305, 19200, 1A300, 00000, 1C2E8, 1E303, 359AD, 18001, 341AF, 182E8, 1A303, 2E204, +2E305, 06108, 19100, 1413C, 351B7, 2E108, 341C9, 00100, 2E108, 06107, 18101, 1413C, 351BF, 2E107, 341C9, 00100, +2E107, 06106, 18101, 14118, 351C7, 2E106, 341C9, 00100, 2E106, 06006, 06109, 15010, 355DB, 06007, 0610A, 15010, +355DB, 06008, 0610B, 15010, 355DB, 0600C, 12002, 351DB, 0C001, 2E00C, 300A4, 06010, 06111, 06212, 06313, 06414, +06515, 2A000, 14061, 2B800, 1407B, 2BC00, 0A0DF, 2A000, 180C6, 2B800, 1C0F6, 2A000, 07010, 301E8, 2B800, 01200, +20206, 20206, 19200, 20206, 18101, 07010, 301E8, 2B800, 19200, 2A000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, +00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 00000, 18D01, 1AC00, 38001, 343FC; diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.DEC b/projects/PicoBlaze/ise/Assembler/UCLOCK.DEC new file mode 100644 index 0000000..a4d9363 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.DEC @@ -0,0 +1,1024 @@ + 0 + 188416 + 188417 + 188418 + 188419 + 188420 + 188421 + 188422 + 188423 + 188424 + 188425 + 188426 + 188427 + 188428 + 196772 + 3328 + 3072 + 245761 + 196885 + 196803 + 288 + 196753 + 81933 + 217106 + 82004 + 217118 + 81985 + 217143 + 196845 + 217106 + 196753 + 81993 + 218140 + 196753 + 81997 + 218140 + 196753 + 81989 + 218140 + 196753 + 81933 + 218156 + 196776 + 213010 + 81952 + 218140 + 196717 + 219154 + 189958 + 189703 + 189448 + 188420 + 188421 + 196776 + 213010 + 196753 + 81996 + 218140 + 196753 + 81985 + 218140 + 196753 + 82002 + 218140 + 196753 + 81997 + 218140 + 196753 + 81933 + 218184 + 196780 + 213010 + 81952 + 218140 + 196753 + 81999 + 217173 + 114945 + 196717 + 219154 + 189961 + 189706 + 189451 + 196780 + 213010 + 196753 + 81998 + 218208 + 196753 + 81933 + 218140 + 24588 + 49154 + 188428 + 196780 + 213010 + 81990 + 218140 + 196753 + 81990 + 218140 + 196753 + 81933 + 218140 + 0 + 188428 + 196772 + 196780 + 213010 + 197100 + 219275 + 5664 + 98561 + 196753 + 81978 + 218251 + 197100 + 219275 + 5408 + 98561 + 196753 + 81978 + 218251 + 197100 + 219275 + 5152 + 98561 + 196753 + 81933 + 218251 + 83480 + 220299 + 83260 + 220299 + 83004 + 220299 + 0 + 131086 + 172032 + 196901 + 196839 + 196916 + 1 + 131086 + 172032 + 28688 + 197090 + 98561 + 172032 + 16384 + 73744 + 218266 + 196997 + 213141 + 20225 + 196765 + 172032 + 16384 + 73730 + 217250 + 196997 + 213149 + 184065 + 172032 + 24588 + 40961 + 180224 + 172032 + 3590 + 196960 + 196796 + 172032 + 3593 + 196960 + 196796 + 196925 + 196839 + 24588 + 73729 + 217270 + 196947 + 172032 + 73730 + 217274 + 196942 + 172032 + 196936 + 172032 + 288 + 32528 + 196765 + 85773 + 176128 + 98561 + 213181 + 288 + 4624 + 98832 + 16384 + 73736 + 218331 + 196757 + 196368 + 85773 + 176128 + 85768 + 217299 + 98561 + 86304 + 218310 + 196842 + 114945 + 82208 + 219353 + 196839 + 196842 + 213190 + 196898 + 213187 + 196836 + 192288 + 196858 + 196836 + 16384 + 73744 + 176128 + 20225 + 213215 + 3853 + 196765 + 172032 + 3872 + 196765 + 172032 + 3848 + 196765 + 172032 + 3923 + 196765 + 3961 + 196765 + 3950 + 196765 + 3956 + 196765 + 3937 + 196765 + 3960 + 196765 + 213258 + 3919 + 196765 + 3958 + 196765 + 3941 + 196765 + 3954 + 196765 + 3942 + 196765 + 3948 + 196765 + 3951 + 196765 + 3959 + 196765 + 196839 + 3909 + 196765 + 3954 + 196765 + 196765 + 3951 + 196765 + 3954 + 196765 + 172032 + 196836 + 3915 + 196765 + 3907 + 196765 + 3920 + 196765 + 3923 + 196765 + 3917 + 196765 + 3891 + 196765 + 3902 + 196765 + 172032 + 3913 + 196765 + 3950 + 196765 + 3958 + 196765 + 3937 + 196765 + 3948 + 196765 + 3945 + 196765 + 3940 + 196765 + 172032 + 3924 + 196765 + 3945 + 196765 + 3949 + 196765 + 3941 + 196765 + 172032 + 3905 + 196765 + 3948 + 196765 + 3937 + 196765 + 3954 + 196765 + 3949 + 196765 + 172032 + 3919 + 196765 + 3910 + 196765 + 196765 + 172032 + 3919 + 196765 + 3918 + 196765 + 172032 + 3905 + 196765 + 3939 + 196765 + 3956 + 196765 + 3945 + 196765 + 3958 + 196765 + 3941 + 196765 + 172032 + 544 + 28896 + 196990 + 192800 + 98817 + 192544 + 98817 + 58 + 192544 + 98817 + 101889 + 28896 + 196990 + 192800 + 98817 + 192544 + 98817 + 58 + 192544 + 98817 + 101889 + 28896 + 196990 + 192800 + 98817 + 192544 + 98817 + 13 + 192544 + 172032 + 304 + 98561 + 114698 + 220543 + 114945 + 98362 + 172032 + 188432 + 188689 + 188946 + 189203 + 189460 + 189717 + 25088 + 25345 + 245760 + 191744 + 191489 + 245761 + 25600 + 25857 + 119840 + 128304 + 25090 + 25347 + 102976 + 111440 + 0 + 115432 + 123651 + 219551 + 98305 + 213402 + 99048 + 107267 + 188930 + 189187 + 25092 + 25349 + 102912 + 107264 + 0 + 115432 + 123651 + 219565 + 98305 + 213423 + 99048 + 107267 + 188932 + 189189 + 24840 + 102656 + 82236 + 217527 + 188680 + 213449 + 256 + 188680 + 24839 + 98561 + 82236 + 217535 + 188679 + 213449 + 256 + 188679 + 24838 + 98561 + 82200 + 217543 + 188678 + 213449 + 256 + 188678 + 24582 + 24841 + 86032 + 218587 + 24583 + 24842 + 86032 + 218587 + 24584 + 24843 + 86032 + 218587 + 24588 + 73730 + 217563 + 49153 + 188428 + 196772 + 24592 + 24849 + 25106 + 25363 + 25620 + 25877 + 172032 + 82017 + 178176 + 82043 + 179200 + 41183 + 172032 + 98502 + 178176 + 114934 + 172032 + 28688 + 197096 + 178176 + 4608 + 131590 + 131590 + 102912 + 131590 + 98561 + 28688 + 197096 + 178176 + 102912 + 172032 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 101633 + 109568 + 229377 + 214012 diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.FMT b/projects/PicoBlaze/ise/Assembler/UCLOCK.FMT new file mode 100644 index 0000000..543cd20 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.FMT @@ -0,0 +1,1008 @@ + ;KCPSM3 Program - Real Time Clock with UART communication. + ; + ;Ken Chapman - Xilinx Ltd - October 2003 + ; + ; + ;Port definitions + ; + CONSTANT UART_status_port, 00 ;UART status input + CONSTANT tx_half_full, 01 ; Transmitter half full - bit0 + CONSTANT tx_full, 02 ; FIFO full - bit1 + CONSTANT rx_half_full, 04 ; Receiver half full - bit2 + CONSTANT rx_full, 08 ; FIFO full - bit3 + CONSTANT rx_data_present, 10 ; data present - bit4 + ; + CONSTANT UART_read_port, 01 ;UART Rx data input + ; + CONSTANT UART_write_port, 01 ;UART Tx data output + ; + CONSTANT alarm_port, 00 ;Alarm output + CONSTANT alarm_control, 01 ; bit0 + ; + ;Special Register usage + ; + NAMEREG sF, UART_data ;used to pass data to and from the UART + ; + NAMEREG sE, store_pointer ;used to pass location of data in scratch pad memory + ; + ;Two registers to form a 16-bit counter used to count + ;interrupt pulses generated at 1us intervals. + ; + NAMEREG sD, int_counter_lsb ;lower 8-bits + NAMEREG sC, int_counter_msb ;upper 8-bits + ; + ; + ;Scratch Pad Memory Locations + ; + ; + CONSTANT us_time_stamp_lsb, 00 ;16-bit micro-second time stamp + CONSTANT us_time_stamp_msb, 01 + ; + CONSTANT us_time_lsb, 02 ;16-bit micro-second real time value + CONSTANT us_time_msb, 03 + ; + CONSTANT ms_time_lsb, 04 ;16-bit milli-second real time value + CONSTANT ms_time_msb, 05 + ; + CONSTANT real_time_hours, 06 ;Current clock time + CONSTANT real_time_minutes, 07 + CONSTANT real_time_seconds, 08 + ; + CONSTANT alarm_time_hours, 09 ;Alarm time + CONSTANT alarm_time_minutes, 0A + CONSTANT alarm_time_seconds, 0B + ; + CONSTANT alarm_status, 0C ;Alarm status + CONSTANT alarm_active, 01 ; bit0 - Alarm is active + CONSTANT alarm_armed, 02 ; bit1 - Alarm is armed + ; + CONSTANT time_preserve0, 10 ;storage for protection of registers + CONSTANT time_preserve1, 11 ;used by the real time clock routine. + CONSTANT time_preserve2, 12 + CONSTANT time_preserve3, 13 + CONSTANT time_preserve4, 14 + CONSTANT time_preserve5, 15 + ; + ;UART character strings will be stored in scratch pad memory ending in carriage return. + ;A string can be up to 16 characters with the start location defined by this constant. + ; + CONSTANT string_start, 20 + ; + ; + ;Initialise the system + ; + ; + cold_start: LOAD s0, 00 ;clear all time values + STORE s0, us_time_stamp_lsb + STORE s0, us_time_stamp_msb + STORE s0, us_time_lsb + STORE s0, us_time_msb + STORE s0, ms_time_lsb + STORE s0, ms_time_msb + STORE s0, real_time_hours + STORE s0, real_time_minutes + STORE s0, real_time_seconds + STORE s0, alarm_time_hours + STORE s0, alarm_time_minutes + STORE s0, alarm_time_seconds + STORE s0, alarm_status ;clear and disable alarm + CALL alarm_drive ;turn off alarm control output port + LOAD int_counter_lsb, 00 ;clear 'us' interrupt counter + LOAD int_counter_msb, 00 + ENABLE INTERRUPT ;enable the 1us interrupts + ; + ; + ;Start of the main program loop. + ; + ;A prompt is transmitted to the UART transmitter and then + ;a command can be entered and interpreted. + ; + ; + prompt_input: CALL send_prompt ;Prompt 'KCPSM3>' + CALL receive_string ;obtain input string and maintain the time + ; + ; + ;Parse the string and perform actions as required + ; + ; + ; + LOAD s1, string_start + CALL fetch_char_from_memory + COMPARE s0, character_CR ;carriage return does nothing + JUMP Z, prompt_input + COMPARE s0, character_T ;start of 'TIME' command? + JUMP Z, test_for_TIME + COMPARE s0, character_A ;start of 'ALARM' command? + JUMP Z, test_for_ALARM + ; + ;trap other command starts here + ; + bad_input_command: CALL send_Syntax_Error ;no valid command + JUMP Z, prompt_input + ; + ; + test_for_TIME: CALL fetch_char_from_memory + COMPARE s0, character_I ;test for rest of 'TIME' + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_M + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_E + JUMP NZ, bad_input_command + ;now have a valid TIME command to process + CALL fetch_char_from_memory + COMPARE s0, character_CR ;carriage return means display time + JUMP NZ, set_time_command + CALL transmit_time ;transmit time to UART + JUMP prompt_input + set_time_command: COMPARE s0, character_space + JUMP NZ, bad_input_command + CALL test_time_string ;interpret 'hh:mm:ss' string + JUMP C, prompt_input ;test for invalid input + STORE s6, real_time_hours ;set new time into clock + STORE s5, real_time_minutes + STORE s4, real_time_seconds + STORE s0, ms_time_lsb ;clear 'ms' counter (s0=00) + STORE s0, ms_time_msb + CALL transmit_time ;transmit new time to UART + JUMP prompt_input + ; + ; + test_for_ALARM: CALL fetch_char_from_memory + COMPARE s0, character_L ;test for rest of 'ALARM' + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_A + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_R + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_M + JUMP NZ, bad_input_command + ;now have a valid ALARM command to process + CALL fetch_char_from_memory + COMPARE s0, character_CR ;carriage return means display alarm time + JUMP NZ, set_alarm_command + CALL transmit_alarm_time ;transmit time to UART + JUMP prompt_input + set_alarm_command: COMPARE s0, character_space ;test for ON or OFF command + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_O + JUMP Z, set_alarm_on_off + SUB s1, 01 ;move memory pointer back to first character of 'hh:mm:ss' string + CALL test_time_string ;interpret 'hh:mm:ss' string + JUMP C, prompt_input ;test for invalid input + STORE s6, alarm_time_hours ;set new time into clock + STORE s5, alarm_time_minutes + STORE s4, alarm_time_seconds + CALL transmit_alarm_time ;transmit new alarm time and status + JUMP prompt_input + set_alarm_on_off: CALL fetch_char_from_memory + COMPARE s0, character_N ;test for 'ON' + JUMP NZ, test_OFF + CALL fetch_char_from_memory + COMPARE s0, character_CR + JUMP NZ, bad_input_command + FETCH s0, alarm_status ;turn alarm on + OR s0, alarm_armed + STORE s0, alarm_status + CALL transmit_alarm_time ;transmit alarm time and status + JUMP prompt_input + test_OFF: COMPARE s0, character_F ;test for for 'OFF' + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_F + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_CR + JUMP NZ, bad_input_command + LOAD s0, 00 ;turn alarm off and stop an active alarm + STORE s0, alarm_status + CALL alarm_drive ;turn off alarm + CALL transmit_alarm_time ;transmit alarm time and status + JUMP prompt_input + ; + ; + ; + ; + ;Read an 'hh:mm:ss' time string and provide new values. + ; + ;The string must be provided in successive scratch pad memory locations + ;with the s1 register containing the location of the first character. + ; + ;A correct time specification will result in the return of new values + ;as follows:- + ; + ; s6 = hours + ; s5 = minutes + ; s4 = seconds + ; + ;If the syntax is incorrect or values are not in the correct ranges an + ;'Invalid Time' message will be transmitted and the CARRY flag will be set + ; + ;Registers used s0, s1, s6, s5 and s4 + ; + test_time_string: CALL 2char_to_value ;obtain hours value + JUMP C, invalid_time ;test for non-decimal characters + LOAD s6, s2 ;remember hours + ADD s1, 01 ;increment memory pointer past hours + CALL fetch_char_from_memory + COMPARE s0, character_colon ;test for colon + JUMP NZ, invalid_time + CALL 2char_to_value ;obtain minutes value + JUMP C, invalid_time ;test for non-decimal characters + LOAD s5, s2 ;remember minutes + ADD s1, 01 ;increment memory pointer past minutes + CALL fetch_char_from_memory + COMPARE s0, character_colon ;test for colon + JUMP NZ, invalid_time + CALL 2char_to_value ;obtain seconds value + JUMP C, invalid_time ;test for non-decimal characters + LOAD s4, s2 ;remember minutes + ADD s1, 01 ;increment memory pointer past seconds + CALL fetch_char_from_memory + COMPARE s0, character_CR ;finish with carriage return + JUMP NZ, invalid_time + ;Have values for hh:mm:ss but need to test if each is valid range. + COMPARE s6, hours_in_a_day + JUMP NC, invalid_time + COMPARE s5, minutes_in_an_hour + JUMP NC, invalid_time + COMPARE s4, seconds_in_a_minute + JUMP NC, invalid_time + LOAD s0, 00 + SR0 s0 ;reset CARRY flag (with s0=0) + RETURN ;time string was OK + invalid_time: CALL send_Invalid + CALL send_space + CALL send_Time + LOAD s0, 01 + SR0 s0 ;set CARRY flag + RETURN ;time string was bad + ; + ; + ;Fetch character from memory, convert to upper case + ;and increment memory pointer. + ; + ;The memory pointer is provided in register s1. + ;The character obtained is returned in register s0. + ; + ;Registers used s0 and s1. + ; +fetch_char_from_memory: FETCH s0, (s1) ;read character + CALL upper_case ;convert to upper case + ADD s1, 01 ;increment memory pointer + RETURN + ; + ; + ; + ;Read one character from the UART + ; + ;Character read will be returned in a register called 'UART_data' and will be + ;echoed to the UART transmitter. + ; + ;The routine first tests the receiver FIFO buffer to see if data is present. + ;If the FIFO is empty, the routine waits until there is a character to read. + ;As this could take any amount of time the wait loop includes a call to the + ;subroutine which updates the real time clock. + ; + ;Registers used s0 and UART_data + ; + read_from_UART: INPUT s0, UART_status_port ;test Rx_FIFO buffer + TEST s0, rx_data_present + JUMP NZ, read_character + CALL update_time ;Perform useful operation whilst waiting + JUMP read_from_UART + read_character: INPUT UART_data, UART_read_port ;read from FIFO + CALL send_to_UART ;echo received character + RETURN + ; + ; + ; + ;Transmit one character to the UART + ; + ;Character supplied in register called 'UART_data'. + ; + ;The routine first tests the transmit FIFO buffer to see if it is full. + ;If the FIFO is full, the routine waits until there is space which could + ;be as long as it takes to transmit one complete character. + ; + ; Baud Rate Time per Character (10 bits) + ; 9600 1,024us + ; 19200 521us + ; 38400 260us + ; 57600 174us + ; 115200 87us + ; + ;Since this is a relatively long duration, the wait loop includes a + ;call to the subroutine which updates the real time clock. + ; + ;Registers used s0 + ; + send_to_UART: INPUT s0, UART_status_port ;test Tx_FIFO buffer + TEST s0, tx_full + JUMP Z, UART_write + CALL update_time ;Perform useful operation whilst waiting + JUMP send_to_UART + UART_write: OUTPUT UART_data, UART_write_port + RETURN + ; + ; + ; + ; + ;Alarm output + ; + ;Uses the alarm status scratch pad memory to set or reset the alarm + ;control bit on the alarm output port. + ; + ;Registers used s0 + ; + alarm_drive: FETCH s0, alarm_status ;read status + AND s0, alarm_active ;isolate bit0 + OUTPUT s0, alarm_port + RETURN + ; + ; + ; + ; + ; + ;Transmit the time to the UART port in the format hh:mm:ss and end + ;with a carriage return. + ; + ;The time to converted must be stored in 3 scratch pad memory locations as + ;defined below. A register named 'store_pointer' must provide the address of + ;first location. + ; + ; Address Data + ; + ; store_pointer ----> hours + ; store_pointer + 1 ----> minutes + ; store_pointer + 1 ----> seconds + ; + ;The routine first converts the time into an ASCII string stored in scratch + ;pad memory starting at a location specified by a constant named 'string_start'. + ;The string will then be transmitted. + ; + ;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ; + transmit_time: LOAD store_pointer, real_time_hours ;locate current time in memory + CALL time_to_ASCII + CALL transmit_string + RETURN + ; + ; + ;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + ;ending with carriage return. + ; + ;The alarm time to converted must be stored in 3 scratch pad memory locations as + ;defined below. A register named 'store_pointer' must provide the address of + ;first location. + ; + ; Address Data + ; + ; store_pointer ----> hours + ; store_pointer + 1 ----> minutes + ; store_pointer + 1 ----> seconds + ; + ;The routine first converts the time into an ASCII string stored in scratch + ;pad memory starting at a location specified by a constant named 'string_start'. + ;The string will then be transmitted. + ; + ;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ; + transmit_alarm_time: LOAD store_pointer, alarm_time_hours ;locate alarm time in memory + CALL time_to_ASCII + CALL transmit_string + CALL send_Alarm + CALL send_space + FETCH s0, alarm_status ;read alarm status + TEST s0, alarm_active ;test for active + JUMP Z, test_armed + CALL send_Active + RETURN + test_armed: TEST s0, alarm_armed ;test for on + JUMP Z, alarm_is_off + CALL send_ON + RETURN + alarm_is_off: CALL send_OFF + RETURN + ; + ; + ;Transmit ASCII string to UART + ; + ;An ASCII string must be provided in scratch pad memory commencing at the + ;location specified by a constant named 'string_start'. The string must + ;end with a carriage return (0D). + ; + ;Registers used s1 and 'UART_data'. + ; s0 is then used in subroutine 'send_to_UART' + ; + transmit_string: LOAD s1, string_start ;locate start of string + next_char_tx: FETCH UART_data, (s1) ;read character from memory + CALL send_to_UART ;transmit character + COMPARE UART_data, character_CR ;test for last character + RETURN Z + ADD s1, 01 ;move to next character + JUMP next_char_tx + ; + ; + ;Receive ASCII string from UART + ; + ;An ASCII string will be read from the UART and stored in scratch pad memory + ;commencing at the location specified by a constant named 'string_start'. + ;The string will will have a maximum length of 16 characters including a + ;carriage return (0D) denoting the end of the string. + ; + ;As each character is read, it is echoed to the UART transmitter. + ;Some minor editing is supported using backspace (BS=08) which is used + ;to adjust what is stored in scratch pad memory and adjust the display + ;on the terminal screen using characters sent to the UART transmitter. + ; + ;A test is made for the receiver FIFO becoming full. A full status is treated as + ;a potential error situation and will result in a 'Overflow Error' message being + ;transmitted to the UART, the receiver FIFO being purged of all data and an + ;empty string being stored (carriage return at first location). + ; + ;Registers used s0, s1, s2 and 'UART_data'. + ; + receive_string: LOAD s1, string_start ;locate start of string + LOAD s2, s1 ;compute 16 character address + ADD s2, 10 + receive_full_test: INPUT s0, UART_status_port ;test Rx_FIFO buffer for full + TEST s0, rx_full + JUMP NZ, read_error + CALL read_from_UART ;obtain and echo character + STORE UART_data, (s1) ;write to memory + COMPARE UART_data, character_CR ;test for end of string + RETURN Z + COMPARE UART_data, character_BS ;test for back space + JUMP Z, BS_edit + ADD s1, 01 ;increment memory pointer + COMPARE s1, s2 ;test for pointer exceeding 16 characters + JUMP NZ, receive_full_test ;next character + CALL send_backspace ;hold end of string position on terminal display + BS_edit: SUB s1, 01 ;memory pointer back one + COMPARE s1, string_start ;test for under flow + JUMP C, string_start_again + CALL send_space ;clear character at current position + CALL send_backspace ;position cursor + JUMP receive_full_test ;next character + string_start_again: CALL send_greater_than ;restore '>' at prompt + JUMP receive_string ;begin again + ;Receiver buffer overflow condition + read_error: CALL send_CR ;Transmit error message + STORE UART_data, string_start ;empty string in memory (start with CR) + CALL send_Overflow_Error + CALL send_CR + clear_UART_Rx_loop: INPUT s0, UART_status_port ;test Rx_FIFO buffer for data + TEST s0, rx_data_present + RETURN Z ;finish when buffer is empty + INPUT UART_data, UART_read_port ;read from FIFO and ignore + JUMP clear_UART_Rx_loop + ; + ; + ; + ;Send Carriage Return to the UART + ; + send_CR: LOAD UART_data, character_CR + CALL send_to_UART + RETURN + ; + ; + ; + ;Send a space to the UART + ; + send_space: LOAD UART_data, character_space + CALL send_to_UART + RETURN + ; + ; + ;Send a back space to the UART + ; + send_backspace: LOAD UART_data, character_BS + CALL send_to_UART + RETURN + ; + ;Send 'Syntax Error' to the UART + ; + send_Syntax_Error: LOAD UART_data, character_S + CALL send_to_UART + LOAD UART_data, character_y + CALL send_to_UART + LOAD UART_data, character_n + CALL send_to_UART + LOAD UART_data, character_t + CALL send_to_UART + LOAD UART_data, character_a + CALL send_to_UART + LOAD UART_data, character_x + CALL send_to_UART + JUMP send_space_Error + ; + ;Send 'Overflow Error' to the UART + ; + send_Overflow_Error: LOAD UART_data, character_O + CALL send_to_UART + LOAD UART_data, character_v + CALL send_to_UART + LOAD UART_data, character_e + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + LOAD UART_data, character_f + CALL send_to_UART + LOAD UART_data, character_l + CALL send_to_UART + LOAD UART_data, character_o + CALL send_to_UART + LOAD UART_data, character_w + CALL send_to_UART + send_space_Error: CALL send_space + ; + ;Send 'Error' to the UART + ; + send_Error: LOAD UART_data, character_E + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + CALL send_to_UART + LOAD UART_data, character_o + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + RETURN + ; + ;Send 'KCPSM3>' prompt to the UART + ; + send_prompt: CALL send_CR ;start new line + LOAD UART_data, character_K + CALL send_to_UART + LOAD UART_data, character_C + CALL send_to_UART + LOAD UART_data, character_P + CALL send_to_UART + LOAD UART_data, character_S + CALL send_to_UART + LOAD UART_data, character_M + CALL send_to_UART + LOAD UART_data, character_3 + CALL send_to_UART + ; + ;Send '>' character to the UART + ; + send_greater_than: LOAD UART_data, character_greater_than + CALL send_to_UART + RETURN + ; + ;Send 'Invalid' string to the UART + ; + send_Invalid: LOAD UART_data, character_I + CALL send_to_UART + LOAD UART_data, character_n + CALL send_to_UART + LOAD UART_data, character_v + CALL send_to_UART + LOAD UART_data, character_a + CALL send_to_UART + LOAD UART_data, character_l + CALL send_to_UART + LOAD UART_data, character_i + CALL send_to_UART + LOAD UART_data, character_d + CALL send_to_UART + RETURN + ; + ;Send 'Time' string to the UART + ; + send_Time: LOAD UART_data, character_T + CALL send_to_UART + LOAD UART_data, character_i + CALL send_to_UART + LOAD UART_data, character_m + CALL send_to_UART + LOAD UART_data, character_e + CALL send_to_UART + RETURN + ; + ;Send 'Alarm' string to the UART + ; + send_Alarm: LOAD UART_data, character_A + CALL send_to_UART + LOAD UART_data, character_l + CALL send_to_UART + LOAD UART_data, character_a + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + LOAD UART_data, character_m + CALL send_to_UART + RETURN + ; + ;Send 'OFF' string to the UART + ; + send_OFF: LOAD UART_data, character_O + CALL send_to_UART + LOAD UART_data, character_F + CALL send_to_UART + CALL send_to_UART + RETURN + ; + ;Send 'ON' string to the UART + ; + send_ON: LOAD UART_data, character_O + CALL send_to_UART + LOAD UART_data, character_N + CALL send_to_UART + RETURN + ; + ;Send 'Active' string to the UART + ; + send_Active: LOAD UART_data, character_A + CALL send_to_UART + LOAD UART_data, character_c + CALL send_to_UART + LOAD UART_data, character_t + CALL send_to_UART + LOAD UART_data, character_i + CALL send_to_UART + LOAD UART_data, character_v + CALL send_to_UART + LOAD UART_data, character_e + CALL send_to_UART + RETURN + ; + ; + ;Convert time to ASCII string in scratch pad memory. + ; + ;The time to converted must be stored in 3 scratch pad memory locations as + ;defined below. A register named 'store_pointer' must provide the address of + ;first location. + ; + ; Address Data + ; + ; store_pointer ----> hours + ; store_pointer + 1 ----> minutes + ; store_pointer + 1 ----> seconds + ; + ;The resulting ASCII string will be stored in scratch pad memory starting at + ;a location specified by a constant named 'string_start'. The string will + ;take the format hh:mm:ss and end with a carriage return. + ; + ;Registers used s0, s1, s2 and 'store_pointer'. + ; + time_to_ASCII: LOAD s2, string_start ;location for string + FETCH s0, (store_pointer) ;read hours value + CALL decimal_to_ASCII ;convert to ASCII + STORE s1, (s2) ;write hours to string + ADD s2, 01 + STORE s0, (s2) + ADD s2, 01 + LOAD s0, character_colon ;write ':' to string + STORE s0, (s2) + ADD s2, 01 + ADD store_pointer, 01 ;move to minutes + FETCH s0, (store_pointer) ;read minutes value + CALL decimal_to_ASCII ;convert to ASCII + STORE s1, (s2) ;write minutes to string + ADD s2, 01 + STORE s0, (s2) + ADD s2, 01 + LOAD s0, character_colon ;write ':' to string + STORE s0, (s2) + ADD s2, 01 + ADD store_pointer, 01 ;move to seconds + FETCH s0, (store_pointer) ;read seconds value + CALL decimal_to_ASCII ;convert to ASCII + STORE s1, (s2) ;write seconds to string + ADD s2, 01 + STORE s0, (s2) + ADD s2, 01 + LOAD s0, character_CR ;finish string with carriage return + STORE s0, (s2) + RETURN + ; + ;Convert value provided in register s0 into ASCII characters + ; + ;The value provided must in the range 0 to 99 and will be converted into + ;two ASCII characters. + ; The number of 'tens' will be representd by an ASCII character returned in register s1. + ; The number of 'units' will be representd by an ASCII character returned in register s0. + ; + ;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + ;the actual decimal value. + ; + ;Registers used s0 and s1. + ; + decimal_to_ASCII: LOAD s1, 30 ;load 'tens' counter with ASCII for '0' + test_for_ten: ADD s1, 01 ;increment 'tens' value + SUB s0, 0A ;try to subtract 10 from the supplied value + JUMP NC, test_for_ten ;repeat if subtraction was possible without underflow. + SUB s1, 01 ;'tens' value one less ten due to underflow + ADD s0, 3A ;restore units value (the remainder) and convert to ASCII + RETURN + ; + ; + ; + ; + ;Real Time Clock + ; + ;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + ;micro-seconds have elapsed since the last update. This allows for just over 65ms between + ;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + ;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + ;is used to update the real time hours, minutes and seconds clock held in scratch pad + ;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + ; + ;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + ;memory during the routine and restored before returning. + ; + ;Useful constants for real time clock operations + ; + CONSTANT count_1000_lsb, E8 ;lower 8-bits of 1000 count value + CONSTANT count_1000_msb, 03 ;upper 8-bits of 1000 count value + CONSTANT hours_in_a_day, 18 ;24 hours in a day + CONSTANT minutes_in_an_hour, 3C ;60 minutes in an hour + CONSTANT seconds_in_a_minute, 3C ;60 seconds in a minute + ; + update_time: STORE s0, time_preserve0 ;preserve contents of registers used during routine + STORE s1, time_preserve1 + STORE s2, time_preserve2 + STORE s3, time_preserve3 + STORE s4, time_preserve4 + STORE s5, time_preserve5 + ; + FETCH s2, us_time_stamp_lsb ;read the previous 'us' time stamp into [s3,s2] + FETCH s3, us_time_stamp_msb + DISABLE INTERRUPT ;Read and store current 'us' time stamp provided by the interrupt + STORE int_counter_lsb, us_time_stamp_lsb ;counter. Interrupts are disabled to ensure that both bytes relate + STORE int_counter_msb, us_time_stamp_msb ;to the same count value. + ENABLE INTERRUPT + FETCH s4, us_time_stamp_lsb ;read the new 'us' time stamp in [s5,s4] + FETCH s5, us_time_stamp_msb ; + SUB s4, s2 ;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + SUBCY s5, s3 ; (This works correctly even if counter has rolled over) + FETCH s2, us_time_lsb ;read current 'us' time into [s3,s2] + FETCH s3, us_time_msb + ADD s2, s4 ;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + ADDCY s3, s5 + ;determine how many 1000us (1ms) units there are (if any) in current 'us' time + LOAD s0, 00 ;reset 'ms' counter + test_1000us: SUB s2, count_1000_lsb ;subtract 1000 from [s3,s2] + SUBCY s3, count_1000_msb + JUMP C, store_us_time ;Carry indicates [s3,s2] was less than 1000us + ADD s0, 01 ;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + JUMP test_1000us ;repeat to see if more than 1ms has elapsed + store_us_time: ADD s2, count_1000_lsb ;add 1000 to restore 'us' value + ADDCY s3, count_1000_msb + STORE s2, us_time_lsb ;store the current value of 'us' + STORE s3, us_time_msb + ;s0 holds the number of 'ms' elapsed since last update (if any). + FETCH s2, ms_time_lsb ;read current 'ms' time into [s3,s2] + FETCH s3, ms_time_msb + ADD s2, s0 ;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + ADDCY s3, 00 + ;determine if there are now more than 1000ms to form 1 second. + LOAD s0, 00 ;reset 'second' counter + SUB s2, count_1000_lsb ;subtract 1000 from [s3,s2] + SUBCY s3, count_1000_msb + JUMP C, restore_ms_time ;Carry indicates [s3,s2] was less than 1000ms + ADD s0, 01 ;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + JUMP store_ms_time ;new value of 'ms' is remainder of subtraction + restore_ms_time: ADD s2, count_1000_lsb ;add 1000 to restore 'ms' value + ADDCY s3, count_1000_msb + store_ms_time: STORE s2, ms_time_lsb ;store the current value of 'ms' + STORE s3, ms_time_msb + ;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + FETCH s1, real_time_seconds ;read seconds + ADD s1, s0 ;add one second if required by s0 + COMPARE s1, seconds_in_a_minute ;test for 1 minute + JUMP Z, inc_minutes + STORE s1, real_time_seconds ;store updated seconds + JUMP time_update_complete + inc_minutes: LOAD s1, 00 ;seconds become zero + STORE s1, real_time_seconds + FETCH s1, real_time_minutes ;read minutes + ADD s1, 01 ;increment minutes + COMPARE s1, minutes_in_an_hour ;test for 1 hour + JUMP Z, inc_hours + STORE s1, real_time_minutes ;store updated minutes + JUMP time_update_complete + inc_hours: LOAD s1, 00 ;minutes become zero + STORE s1, real_time_minutes + FETCH s1, real_time_hours ;read hours + ADD s1, 01 ;increment hours + COMPARE s1, hours_in_a_day ;test for 24 hours + JUMP Z, reset_hours + STORE s1, real_time_hours ;store updated hours + JUMP time_update_complete + reset_hours: LOAD s1, 00 ;hours become zero + STORE s1, real_time_hours + ; + ;With the time updated, there is then a test for time=alarm time + ; + time_update_complete: FETCH s0, real_time_hours + FETCH s1, alarm_time_hours ;compare hours + COMPARE s0, s1 + JUMP NZ, finish_update + FETCH s0, real_time_minutes ;compare minutes + FETCH s1, alarm_time_minutes + COMPARE s0, s1 + JUMP NZ, finish_update + FETCH s0, real_time_seconds ;compare seconds + FETCH s1, alarm_time_seconds + COMPARE s0, s1 + JUMP NZ, finish_update + FETCH s0, alarm_status ;test if alarm is turned on + TEST s0, alarm_armed + JUMP Z, finish_update ;alarm was off + OR s0, alarm_active ;activate alarm + STORE s0, alarm_status + CALL alarm_drive + finish_update: FETCH s0, time_preserve0 ;restore the register contents + FETCH s1, time_preserve1 + FETCH s2, time_preserve2 + FETCH s3, time_preserve3 + FETCH s4, time_preserve4 + FETCH s5, time_preserve5 + RETURN + ; + ;Convert character to upper case + ; + ;The character supplied in register s0. + ;If the character is in the range 'a' to 'z', it is converted + ;to the equivalent upper case character in the range 'A' to 'Z'. + ;All other characters remain unchanged. + ; + ;Registers used s0. + ; + upper_case: COMPARE s0, 61 ;eliminate character codes below 'a' (61 hex) + RETURN C + COMPARE s0, 7B ;eliminate character codes above 'z' (7A hex) + RETURN NC + AND s0, DF ;mask bit5 to convert to upper case + RETURN + ; + ; + ;Convert character '0' to '9' to numerical value in range 0 to 9 + ; + ;The character supplied in register s0. If the character is in the + ;range '0' to '9', it is converted to the equivalent decimal value. + ;Characters not in the range '0' to '9' are signified by the return + ;with the CARRY flag set. + ; + ;Registers used s0. + ; + 1char_to_value: ADD s0, C6 ;reject character codes above '9' (39 hex) + RETURN C ;carry flag is set + SUB s0, F6 ;reject character codes below '0' (30 hex) + RETURN ;carry is set if value not in range + ; + ; + ;Determine the numerical value of a two character decimal string held in + ;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + ; + ;The string must be stored as in two consecutive memory locations and the + ;location of the first (tens) character supplied in the s1 register. + ;The result is provided in register s2. Strings not using characters in the + ;range '0' to '9' are signified by the return with the CARRY flag set. + ; + ;Registers used s0, s1 and s2. + ; + 2char_to_value: FETCH s0, (s1) ;read 'tens' character + CALL 1char_to_value ;convert to numerical value + RETURN C ;bad character - CARRY set + LOAD s2, s0 + SL0 s2 ;multiply 'tens' value by 10 (0A hex) + SL0 s2 + ADD s2, s0 + SL0 s2 + ADD s1, 01 ;read 'units' character + FETCH s0, (s1) + CALL 1char_to_value ;convert to numerical value + RETURN C ;bad character - CARRY set + ADD s2, s0 ;add units to result and clear CARRY flag + RETURN + ; + ; + ;Interrupt service routine (ISR) + ; + ;The interrupt is used to increment a 16-bit counter formed with two registers + ;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + ;of micro-seconds elapsed. The counter is 'free running' in that it will count + ;up to 65,535 and then roll over to zero. The count value is then used in other + ;parts of the program as required and where it is less time critical. + ; + ;The ISR only uses the specified counter registers + ; + ADDRESS 3FC + ISR: ADD int_counter_lsb, 01 ;add 1us to 16-bit counter + ADDCY int_counter_msb, 00 + RETURNI ENABLE + ; + ;Interrupt vector + ; + ADDRESS 3FF + JUMP ISR + ; + ; + ;Useful constants + ; + ; + ;ASCII table + ; + CONSTANT character_a, 61 + CONSTANT character_b, 62 + CONSTANT character_c, 63 + CONSTANT character_d, 64 + CONSTANT character_e, 65 + CONSTANT character_f, 66 + CONSTANT character_g, 67 + CONSTANT character_h, 68 + CONSTANT character_i, 69 + CONSTANT character_j, 6A + CONSTANT character_k, 6B + CONSTANT character_l, 6C + CONSTANT character_m, 6D + CONSTANT character_n, 6E + CONSTANT character_o, 6F + CONSTANT character_p, 70 + CONSTANT character_q, 71 + CONSTANT character_r, 72 + CONSTANT character_s, 73 + CONSTANT character_t, 74 + CONSTANT character_u, 75 + CONSTANT character_v, 76 + CONSTANT character_w, 77 + CONSTANT character_x, 78 + CONSTANT character_y, 79 + CONSTANT character_z, 7A + CONSTANT character_A, 41 + CONSTANT character_B, 42 + CONSTANT character_C, 43 + CONSTANT character_D, 44 + CONSTANT character_E, 45 + CONSTANT character_F, 46 + CONSTANT character_G, 47 + CONSTANT character_H, 48 + CONSTANT character_I, 49 + CONSTANT character_J, 4A + CONSTANT character_K, 4B + CONSTANT character_L, 4C + CONSTANT character_M, 4D + CONSTANT character_N, 4E + CONSTANT character_O, 4F + CONSTANT character_P, 50 + CONSTANT character_Q, 51 + CONSTANT character_R, 52 + CONSTANT character_S, 53 + CONSTANT character_T, 54 + CONSTANT character_U, 55 + CONSTANT character_V, 56 + CONSTANT character_W, 57 + CONSTANT character_X, 58 + CONSTANT character_Y, 59 + CONSTANT character_Z, 5A + CONSTANT character_0, 30 + CONSTANT character_1, 31 + CONSTANT character_2, 32 + CONSTANT character_3, 33 + CONSTANT character_4, 34 + CONSTANT character_5, 35 + CONSTANT character_6, 36 + CONSTANT character_7, 37 + CONSTANT character_8, 38 + CONSTANT character_9, 39 + CONSTANT character_colon, 3A + CONSTANT character_semi_colon, 3B + CONSTANT character_less_than, 3C + CONSTANT character_greater_than, 3E + CONSTANT character_equals, 3D + CONSTANT character_space, 20 + CONSTANT character_CR, 0D ;carriage return + CONSTANT character_question, 3F ;'?' + CONSTANT character_dollar, 24 + CONSTANT character_BS, 08 ;Back Space command character + ; diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.HEX b/projects/PicoBlaze/ise/Assembler/UCLOCK.HEX new file mode 100644 index 0000000..b0dc4ec --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.HEX @@ -0,0 +1,1024 @@ +00000 +2E000 +2E001 +2E002 +2E003 +2E004 +2E005 +2E006 +2E007 +2E008 +2E009 +2E00A +2E00B +2E00C +300A4 +00D00 +00C00 +3C001 +30115 +300C3 +00120 +30091 +1400D +35012 +14054 +3501E +14041 +35037 +300ED +35012 +30091 +14049 +3541C +30091 +1404D +3541C +30091 +14045 +3541C +30091 +1400D +3542C +300A8 +34012 +14020 +3541C +3006D +35812 +2E606 +2E507 +2E408 +2E004 +2E005 +300A8 +34012 +30091 +1404C +3541C +30091 +14041 +3541C +30091 +14052 +3541C +30091 +1404D +3541C +30091 +1400D +35448 +300AC +34012 +14020 +3541C +30091 +1404F +35055 +1C101 +3006D +35812 +2E609 +2E50A +2E40B +300AC +34012 +30091 +1404E +35460 +30091 +1400D +3541C +0600C +0C002 +2E00C +300AC +34012 +14046 +3541C +30091 +14046 +3541C +30091 +1400D +3541C +00000 +2E00C +300A4 +300AC +34012 +301EC +3588B +01620 +18101 +30091 +1403A +3548B +301EC +3588B +01520 +18101 +30091 +1403A +3548B +301EC +3588B +01420 +18101 +30091 +1400D +3548B +14618 +35C8B +1453C +35C8B +1443C +35C8B +00000 +2000E +2A000 +30125 +300E7 +30134 +00001 +2000E +2A000 +07010 +301E2 +18101 +2A000 +04000 +12010 +3549A +30185 +34095 +04F01 +3009D +2A000 +04000 +12002 +350A2 +30185 +3409D +2CF01 +2A000 +0600C +0A001 +2C000 +2A000 +00E06 +30160 +300BC +2A000 +00E09 +30160 +300BC +3013D +300E7 +0600C +12001 +350B6 +30153 +2A000 +12002 +350BA +3014E +2A000 +30148 +2A000 +00120 +07F10 +3009D +14F0D +2B000 +18101 +340BD +00120 +01210 +18210 +04000 +12008 +354DB +30095 +2FF10 +14F0D +2B000 +14F08 +350D3 +18101 +15120 +354C6 +300EA +1C101 +14120 +358D9 +300E7 +300EA +340C6 +30122 +340C3 +300E4 +2EF20 +300FA +300E4 +04000 +12010 +2B000 +04F01 +340DF +00F0D +3009D +2A000 +00F20 +3009D +2A000 +00F08 +3009D +2A000 +00F53 +3009D +00F79 +3009D +00F6E +3009D +00F74 +3009D +00F61 +3009D +00F78 +3009D +3410A +00F4F +3009D +00F76 +3009D +00F65 +3009D +00F72 +3009D +00F66 +3009D +00F6C +3009D +00F6F +3009D +00F77 +3009D +300E7 +00F45 +3009D +00F72 +3009D +3009D +00F6F +3009D +00F72 +3009D +2A000 +300E4 +00F4B +3009D +00F43 +3009D +00F50 +3009D +00F53 +3009D +00F4D +3009D +00F33 +3009D +00F3E +3009D +2A000 +00F49 +3009D +00F6E +3009D +00F76 +3009D +00F61 +3009D +00F6C +3009D +00F69 +3009D +00F64 +3009D +2A000 +00F54 +3009D +00F69 +3009D +00F6D +3009D +00F65 +3009D +2A000 +00F41 +3009D +00F6C +3009D +00F61 +3009D +00F72 +3009D +00F6D +3009D +2A000 +00F4F +3009D +00F46 +3009D +3009D +2A000 +00F4F +3009D +00F4E +3009D +2A000 +00F41 +3009D +00F63 +3009D +00F74 +3009D +00F69 +3009D +00F76 +3009D +00F65 +3009D +2A000 +00220 +070E0 +3017E +2F120 +18201 +2F020 +18201 +0003A +2F020 +18201 +18E01 +070E0 +3017E +2F120 +18201 +2F020 +18201 +0003A +2F020 +18201 +18E01 +070E0 +3017E +2F120 +18201 +2F020 +18201 +0000D +2F020 +2A000 +00130 +18101 +1C00A +35D7F +1C101 +1803A +2A000 +2E010 +2E111 +2E212 +2E313 +2E414 +2E515 +06200 +06301 +3C000 +2ED00 +2EC01 +3C001 +06400 +06501 +1D420 +1F530 +06202 +06303 +19240 +1B350 +00000 +1C2E8 +1E303 +3599F +18001 +3419A +182E8 +1A303 +2E202 +2E303 +06204 +06305 +19200 +1A300 +00000 +1C2E8 +1E303 +359AD +18001 +341AF +182E8 +1A303 +2E204 +2E305 +06108 +19100 +1413C +351B7 +2E108 +341C9 +00100 +2E108 +06107 +18101 +1413C +351BF +2E107 +341C9 +00100 +2E107 +06106 +18101 +14118 +351C7 +2E106 +341C9 +00100 +2E106 +06006 +06109 +15010 +355DB +06007 +0610A +15010 +355DB +06008 +0610B +15010 +355DB +0600C +12002 +351DB +0C001 +2E00C +300A4 +06010 +06111 +06212 +06313 +06414 +06515 +2A000 +14061 +2B800 +1407B +2BC00 +0A0DF +2A000 +180C6 +2B800 +1C0F6 +2A000 +07010 +301E8 +2B800 +01200 +20206 +20206 +19200 +20206 +18101 +07010 +301E8 +2B800 +19200 +2A000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +18D01 +1AC00 +38001 +343FC diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.LOG b/projects/PicoBlaze/ise/Assembler/UCLOCK.LOG new file mode 100644 index 0000000..b3a3340 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.LOG @@ -0,0 +1,1015 @@ +KCPSM3 Assembler log file for program 'uclock.psm'. +Generated by KCPSM3 version 1.30 +Ken Chapman (Xilinx Ltd) 2005. +25Sep2005-15:52:57 + + Addr Code + + 000 ;KCPSM3 Program - Real Time Clock with UART communication. + 000 ; + 000 ;Ken Chapman - Xilinx Ltd - October 2003 + 000 ; + 000 ; + 000 ;Port definitions + 000 ; + 000 CONSTANT UART_status_port, 00 ;UART status input + 000 CONSTANT tx_half_full, 01 ; Transmitter half full - bit0 + 000 CONSTANT tx_full, 02 ; FIFO full - bit1 + 000 CONSTANT rx_half_full, 04 ; Receiver half full - bit2 + 000 CONSTANT rx_full, 08 ; FIFO full - bit3 + 000 CONSTANT rx_data_present, 10 ; data present - bit4 + 000 ; + 000 CONSTANT UART_read_port, 01 ;UART Rx data input + 000 ; + 000 CONSTANT UART_write_port, 01 ;UART Tx data output + 000 ; + 000 CONSTANT alarm_port, 00 ;Alarm output + 000 CONSTANT alarm_control, 01 ; bit0 + 000 ; + 000 ;Special Register usage + 000 ; + 000 NAMEREG sF, UART_data ;used to pass data to and from the UART + 000 ; + 000 NAMEREG sE, store_pointer ;used to pass location of data in scratch pad memory + 000 ; + 000 ;Two registers to form a 16-bit counter used to count + 000 ;interrupt pulses generated at 1us intervals. + 000 ; + 000 NAMEREG sD, int_counter_lsb ;lower 8-bits + 000 NAMEREG sC, int_counter_msb ;upper 8-bits + 000 ; + 000 ; + 000 ;Scratch Pad Memory Locations + 000 ; + 000 ; + 000 CONSTANT us_time_stamp_lsb, 00 ;16-bit micro-second time stamp + 000 CONSTANT us_time_stamp_msb, 01 + 000 ; + 000 CONSTANT us_time_lsb, 02 ;16-bit micro-second real time value + 000 CONSTANT us_time_msb, 03 + 000 ; + 000 CONSTANT ms_time_lsb, 04 ;16-bit milli-second real time value + 000 CONSTANT ms_time_msb, 05 + 000 ; + 000 CONSTANT real_time_hours, 06 ;Current clock time + 000 CONSTANT real_time_minutes, 07 + 000 CONSTANT real_time_seconds, 08 + 000 ; + 000 CONSTANT alarm_time_hours, 09 ;Alarm time + 000 CONSTANT alarm_time_minutes, 0A + 000 CONSTANT alarm_time_seconds, 0B + 000 ; + 000 CONSTANT alarm_status, 0C ;Alarm status + 000 CONSTANT alarm_active, 01 ; bit0 - Alarm is active + 000 CONSTANT alarm_armed, 02 ; bit1 - Alarm is armed + 000 ; + 000 CONSTANT time_preserve0, 10 ;storage for protection of registers + 000 CONSTANT time_preserve1, 11 ;used by the real time clock routine. + 000 CONSTANT time_preserve2, 12 + 000 CONSTANT time_preserve3, 13 + 000 CONSTANT time_preserve4, 14 + 000 CONSTANT time_preserve5, 15 + 000 ; + 000 ;UART character strings will be stored in scratch pad memory ending in carriage return. + 000 ;A string can be up to 16 characters with the start location defined by this constant. + 000 ; + 000 CONSTANT string_start, 20 + 000 ; + 000 ; + 000 ;Initialise the system + 000 ; + 000 ; + 000 00000 cold_start: LOAD s0, 00 ;clear all time values + 001 2E000 STORE s0, us_time_stamp_lsb[00] + 002 2E001 STORE s0, us_time_stamp_msb[01] + 003 2E002 STORE s0, us_time_lsb[02] + 004 2E003 STORE s0, us_time_msb[03] + 005 2E004 STORE s0, ms_time_lsb[04] + 006 2E005 STORE s0, ms_time_msb[05] + 007 2E006 STORE s0, real_time_hours[06] + 008 2E007 STORE s0, real_time_minutes[07] + 009 2E008 STORE s0, real_time_seconds[08] + 00A 2E009 STORE s0, alarm_time_hours[09] + 00B 2E00A STORE s0, alarm_time_minutes[0A] + 00C 2E00B STORE s0, alarm_time_seconds[0B] + 00D 2E00C STORE s0, alarm_status[0C] ;clear and disable alarm + 00E 300A4 CALL alarm_drive[0A4] ;turn off alarm control output port + 00F 00D00 LOAD int_counter_lsb[sD], 00 ;clear 'us' interrupt counter + 010 00C00 LOAD int_counter_msb[sC], 00 + 011 3C001 ENABLE INTERRUPT ;enable the 1us interrupts + 012 ; + 012 ; + 012 ;Start of the main program loop. + 012 ; + 012 ;A prompt is transmitted to the UART transmitter and then + 012 ;a command can be entered and interpreted. + 012 ; + 012 ; + 012 30115 prompt_input: CALL send_prompt[115] ;Prompt 'KCPSM3>' + 013 300C3 CALL receive_string[0C3] ;obtain input string and maintain the time + 014 ; + 014 ; + 014 ;Parse the string and perform actions as required + 014 ; + 014 ; + 014 ; + 014 00120 LOAD s1, string_start[20] + 015 30091 CALL fetch_char_from_memory[091] + 016 1400D COMPARE s0, character_CR[0D] ;carriage return does nothing + 017 35012 JUMP Z, prompt_input[012] + 018 14054 COMPARE s0, character_T[54] ;start of 'TIME' command? + 019 3501E JUMP Z, test_for_TIME[01E] + 01A 14041 COMPARE s0, character_A[41] ;start of 'ALARM' command? + 01B 35037 JUMP Z, test_for_ALARM[037] + 01C ; + 01C ;trap other command starts here + 01C ; + 01C 300ED bad_input_command: CALL send_Syntax_Error[0ED] ;no valid command + 01D 35012 JUMP Z, prompt_input[012] + 01E ; + 01E ; + 01E 30091 test_for_TIME: CALL fetch_char_from_memory[091] + 01F 14049 COMPARE s0, character_I[49] ;test for rest of 'TIME' + 020 3541C JUMP NZ, bad_input_command[01C] + 021 30091 CALL fetch_char_from_memory[091] + 022 1404D COMPARE s0, character_M[4D] + 023 3541C JUMP NZ, bad_input_command[01C] + 024 30091 CALL fetch_char_from_memory[091] + 025 14045 COMPARE s0, character_E[45] + 026 3541C JUMP NZ, bad_input_command[01C] + 027 ;now have a valid TIME command to process + 027 30091 CALL fetch_char_from_memory[091] + 028 1400D COMPARE s0, character_CR[0D] ;carriage return means display time + 029 3542C JUMP NZ, set_time_command[02C] + 02A 300A8 CALL transmit_time[0A8] ;transmit time to UART + 02B 34012 JUMP prompt_input[012] + 02C 14020 set_time_command: COMPARE s0, character_space[20] + 02D 3541C JUMP NZ, bad_input_command[01C] + 02E 3006D CALL test_time_string[06D] ;interpret 'hh:mm:ss' string + 02F 35812 JUMP C, prompt_input[012] ;test for invalid input + 030 2E606 STORE s6, real_time_hours[06] ;set new time into clock + 031 2E507 STORE s5, real_time_minutes[07] + 032 2E408 STORE s4, real_time_seconds[08] + 033 2E004 STORE s0, ms_time_lsb[04] ;clear 'ms' counter (s0=00) + 034 2E005 STORE s0, ms_time_msb[05] + 035 300A8 CALL transmit_time[0A8] ;transmit new time to UART + 036 34012 JUMP prompt_input[012] + 037 ; + 037 ; + 037 30091 test_for_ALARM: CALL fetch_char_from_memory[091] + 038 1404C COMPARE s0, character_L[4C] ;test for rest of 'ALARM' + 039 3541C JUMP NZ, bad_input_command[01C] + 03A 30091 CALL fetch_char_from_memory[091] + 03B 14041 COMPARE s0, character_A[41] + 03C 3541C JUMP NZ, bad_input_command[01C] + 03D 30091 CALL fetch_char_from_memory[091] + 03E 14052 COMPARE s0, character_R[52] + 03F 3541C JUMP NZ, bad_input_command[01C] + 040 30091 CALL fetch_char_from_memory[091] + 041 1404D COMPARE s0, character_M[4D] + 042 3541C JUMP NZ, bad_input_command[01C] + 043 ;now have a valid ALARM command to process + 043 30091 CALL fetch_char_from_memory[091] + 044 1400D COMPARE s0, character_CR[0D] ;carriage return means display alarm time + 045 35448 JUMP NZ, set_alarm_command[048] + 046 300AC CALL transmit_alarm_time[0AC] ;transmit time to UART + 047 34012 JUMP prompt_input[012] + 048 14020 set_alarm_command: COMPARE s0, character_space[20] ;test for ON or OFF command + 049 3541C JUMP NZ, bad_input_command[01C] + 04A 30091 CALL fetch_char_from_memory[091] + 04B 1404F COMPARE s0, character_O[4F] + 04C 35055 JUMP Z, set_alarm_on_off[055] + 04D 1C101 SUB s1, 01 ;move memory pointer back to first character of 'hh:mm:ss' string + 04E 3006D CALL test_time_string[06D] ;interpret 'hh:mm:ss' string + 04F 35812 JUMP C, prompt_input[012] ;test for invalid input + 050 2E609 STORE s6, alarm_time_hours[09] ;set new time into clock + 051 2E50A STORE s5, alarm_time_minutes[0A] + 052 2E40B STORE s4, alarm_time_seconds[0B] + 053 300AC CALL transmit_alarm_time[0AC] ;transmit new alarm time and status + 054 34012 JUMP prompt_input[012] + 055 30091 set_alarm_on_off: CALL fetch_char_from_memory[091] + 056 1404E COMPARE s0, character_N[4E] ;test for 'ON' + 057 35460 JUMP NZ, test_OFF[060] + 058 30091 CALL fetch_char_from_memory[091] + 059 1400D COMPARE s0, character_CR[0D] + 05A 3541C JUMP NZ, bad_input_command[01C] + 05B 0600C FETCH s0, alarm_status[0C] ;turn alarm on + 05C 0C002 OR s0, alarm_armed[02] + 05D 2E00C STORE s0, alarm_status[0C] + 05E 300AC CALL transmit_alarm_time[0AC] ;transmit alarm time and status + 05F 34012 JUMP prompt_input[012] + 060 14046 test_OFF: COMPARE s0, character_F[46] ;test for for 'OFF' + 061 3541C JUMP NZ, bad_input_command[01C] + 062 30091 CALL fetch_char_from_memory[091] + 063 14046 COMPARE s0, character_F[46] + 064 3541C JUMP NZ, bad_input_command[01C] + 065 30091 CALL fetch_char_from_memory[091] + 066 1400D COMPARE s0, character_CR[0D] + 067 3541C JUMP NZ, bad_input_command[01C] + 068 00000 LOAD s0, 00 ;turn alarm off and stop an active alarm + 069 2E00C STORE s0, alarm_status[0C] + 06A 300A4 CALL alarm_drive[0A4] ;turn off alarm + 06B 300AC CALL transmit_alarm_time[0AC] ;transmit alarm time and status + 06C 34012 JUMP prompt_input[012] + 06D ; + 06D ; + 06D ; + 06D ; + 06D ;Read an 'hh:mm:ss' time string and provide new values. + 06D ; + 06D ;The string must be provided in successive scratch pad memory locations + 06D ;with the s1 register containing the location of the first character. + 06D ; + 06D ;A correct time specification will result in the return of new values + 06D ;as follows:- + 06D ; + 06D ; s6 = hours + 06D ; s5 = minutes + 06D ; s4 = seconds + 06D ; + 06D ;If the syntax is incorrect or values are not in the correct ranges an + 06D ;'Invalid Time' message will be transmitted and the CARRY flag will be set + 06D ; + 06D ;Registers used s0, s1, s6, s5 and s4 + 06D ; + 06D 301EC test_time_string: CALL 2char_to_value[1EC] ;obtain hours value + 06E 3588B JUMP C, invalid_time[08B] ;test for non-decimal characters + 06F 01620 LOAD s6, s2 ;remember hours + 070 18101 ADD s1, 01 ;increment memory pointer past hours + 071 30091 CALL fetch_char_from_memory[091] + 072 1403A COMPARE s0, character_colon[3A] ;test for colon + 073 3548B JUMP NZ, invalid_time[08B] + 074 301EC CALL 2char_to_value[1EC] ;obtain minutes value + 075 3588B JUMP C, invalid_time[08B] ;test for non-decimal characters + 076 01520 LOAD s5, s2 ;remember minutes + 077 18101 ADD s1, 01 ;increment memory pointer past minutes + 078 30091 CALL fetch_char_from_memory[091] + 079 1403A COMPARE s0, character_colon[3A] ;test for colon + 07A 3548B JUMP NZ, invalid_time[08B] + 07B 301EC CALL 2char_to_value[1EC] ;obtain seconds value + 07C 3588B JUMP C, invalid_time[08B] ;test for non-decimal characters + 07D 01420 LOAD s4, s2 ;remember minutes + 07E 18101 ADD s1, 01 ;increment memory pointer past seconds + 07F 30091 CALL fetch_char_from_memory[091] + 080 1400D COMPARE s0, character_CR[0D] ;finish with carriage return + 081 3548B JUMP NZ, invalid_time[08B] + 082 ;Have values for hh:mm:ss but need to test if each is valid range. + 082 14618 COMPARE s6, hours_in_a_day[18] + 083 35C8B JUMP NC, invalid_time[08B] + 084 1453C COMPARE s5, minutes_in_an_hour[3C] + 085 35C8B JUMP NC, invalid_time[08B] + 086 1443C COMPARE s4, seconds_in_a_minute[3C] + 087 35C8B JUMP NC, invalid_time[08B] + 088 00000 LOAD s0, 00 + 089 2000E SR0 s0 ;reset CARRY flag (with s0=0) + 08A 2A000 RETURN ;time string was OK + 08B 30125 invalid_time: CALL send_Invalid[125] + 08C 300E7 CALL send_space[0E7] + 08D 30134 CALL send_Time[134] + 08E 00001 LOAD s0, 01 + 08F 2000E SR0 s0 ;set CARRY flag + 090 2A000 RETURN ;time string was bad + 091 ; + 091 ; + 091 ;Fetch character from memory, convert to upper case + 091 ;and increment memory pointer. + 091 ; + 091 ;The memory pointer is provided in register s1. + 091 ;The character obtained is returned in register s0. + 091 ; + 091 ;Registers used s0 and s1. + 091 ; + 091 07010 fetch_char_from_memory: FETCH s0, (s1) ;read character + 092 301E2 CALL upper_case[1E2] ;convert to upper case + 093 18101 ADD s1, 01 ;increment memory pointer + 094 2A000 RETURN + 095 ; + 095 ; + 095 ; + 095 ;Read one character from the UART + 095 ; + 095 ;Character read will be returned in a register called 'UART_data' and will be + 095 ;echoed to the UART transmitter. + 095 ; + 095 ;The routine first tests the receiver FIFO buffer to see if data is present. + 095 ;If the FIFO is empty, the routine waits until there is a character to read. + 095 ;As this could take any amount of time the wait loop includes a call to the + 095 ;subroutine which updates the real time clock. + 095 ; + 095 ;Registers used s0 and UART_data + 095 ; + 095 04000 read_from_UART: INPUT s0, UART_status_port[00] ;test Rx_FIFO buffer + 096 12010 TEST s0, rx_data_present[10] + 097 3549A JUMP NZ, read_character[09A] + 098 30185 CALL update_time[185] ;Perform useful operation whilst waiting + 099 34095 JUMP read_from_UART[095] + 09A 04F01 read_character: INPUT UART_data[sF], UART_read_port[01] ;read from FIFO + 09B 3009D CALL send_to_UART[09D] ;echo received character + 09C 2A000 RETURN + 09D ; + 09D ; + 09D ; + 09D ;Transmit one character to the UART + 09D ; + 09D ;Character supplied in register called 'UART_data'. + 09D ; + 09D ;The routine first tests the transmit FIFO buffer to see if it is full. + 09D ;If the FIFO is full, the routine waits until there is space which could + 09D ;be as long as it takes to transmit one complete character. + 09D ; + 09D ; Baud Rate Time per Character (10 bits) + 09D ; 9600 1,024us + 09D ; 19200 521us + 09D ; 38400 260us + 09D ; 57600 174us + 09D ; 115200 87us + 09D ; + 09D ;Since this is a relatively long duration, the wait loop includes a + 09D ;call to the subroutine which updates the real time clock. + 09D ; + 09D ;Registers used s0 + 09D ; + 09D 04000 send_to_UART: INPUT s0, UART_status_port[00] ;test Tx_FIFO buffer + 09E 12002 TEST s0, tx_full[02] + 09F 350A2 JUMP Z, UART_write[0A2] + 0A0 30185 CALL update_time[185] ;Perform useful operation whilst waiting + 0A1 3409D JUMP send_to_UART[09D] + 0A2 2CF01 UART_write: OUTPUT UART_data[sF], UART_write_port[01] + 0A3 2A000 RETURN + 0A4 ; + 0A4 ; + 0A4 ; + 0A4 ; + 0A4 ;Alarm output + 0A4 ; + 0A4 ;Uses the alarm status scratch pad memory to set or reset the alarm + 0A4 ;control bit on the alarm output port. + 0A4 ; + 0A4 ;Registers used s0 + 0A4 ; + 0A4 0600C alarm_drive: FETCH s0, alarm_status[0C] ;read status + 0A5 0A001 AND s0, alarm_active[01] ;isolate bit0 + 0A6 2C000 OUTPUT s0, alarm_port[00] + 0A7 2A000 RETURN + 0A8 ; + 0A8 ; + 0A8 ; + 0A8 ; + 0A8 ; + 0A8 ;Transmit the time to the UART port in the format hh:mm:ss and end + 0A8 ;with a carriage return. + 0A8 ; + 0A8 ;The time to converted must be stored in 3 scratch pad memory locations as + 0A8 ;defined below. A register named 'store_pointer' must provide the address of + 0A8 ;first location. + 0A8 ; + 0A8 ; Address Data + 0A8 ; + 0A8 ; store_pointer ----> hours + 0A8 ; store_pointer + 1 ----> minutes + 0A8 ; store_pointer + 1 ----> seconds + 0A8 ; + 0A8 ;The routine first converts the time into an ASCII string stored in scratch + 0A8 ;pad memory starting at a location specified by a constant named 'string_start'. + 0A8 ;The string will then be transmitted. + 0A8 ; + 0A8 ;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + 0A8 ; + 0A8 00E06 transmit_time: LOAD store_pointer[sE], real_time_hours[06] ;locate current time in memory + 0A9 30160 CALL time_to_ASCII[160] + 0AA 300BC CALL transmit_string[0BC] + 0AB 2A000 RETURN + 0AC ; + 0AC ; + 0AC ;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + 0AC ;ending with carriage return. + 0AC ; + 0AC ;The alarm time to converted must be stored in 3 scratch pad memory locations as + 0AC ;defined below. A register named 'store_pointer' must provide the address of + 0AC ;first location. + 0AC ; + 0AC ; Address Data + 0AC ; + 0AC ; store_pointer ----> hours + 0AC ; store_pointer + 1 ----> minutes + 0AC ; store_pointer + 1 ----> seconds + 0AC ; + 0AC ;The routine first converts the time into an ASCII string stored in scratch + 0AC ;pad memory starting at a location specified by a constant named 'string_start'. + 0AC ;The string will then be transmitted. + 0AC ; + 0AC ;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + 0AC ; + 0AC 00E09 transmit_alarm_time: LOAD store_pointer[sE], alarm_time_hours[09] ;locate alarm time in memory + 0AD 30160 CALL time_to_ASCII[160] + 0AE 300BC CALL transmit_string[0BC] + 0AF 3013D CALL send_Alarm[13D] + 0B0 300E7 CALL send_space[0E7] + 0B1 0600C FETCH s0, alarm_status[0C] ;read alarm status + 0B2 12001 TEST s0, alarm_active[01] ;test for active + 0B3 350B6 JUMP Z, test_armed[0B6] + 0B4 30153 CALL send_Active[153] + 0B5 2A000 RETURN + 0B6 12002 test_armed: TEST s0, alarm_armed[02] ;test for on + 0B7 350BA JUMP Z, alarm_is_off[0BA] + 0B8 3014E CALL send_ON[14E] + 0B9 2A000 RETURN + 0BA 30148 alarm_is_off: CALL send_OFF[148] + 0BB 2A000 RETURN + 0BC ; + 0BC ; + 0BC ;Transmit ASCII string to UART + 0BC ; + 0BC ;An ASCII string must be provided in scratch pad memory commencing at the + 0BC ;location specified by a constant named 'string_start'. The string must + 0BC ;end with a carriage return (0D). + 0BC ; + 0BC ;Registers used s1 and 'UART_data'. + 0BC ; s0 is then used in subroutine 'send_to_UART' + 0BC ; + 0BC 00120 transmit_string: LOAD s1, string_start[20] ;locate start of string + 0BD 07F10 next_char_tx: FETCH UART_data[sF], (s1) ;read character from memory + 0BE 3009D CALL send_to_UART[09D] ;transmit character + 0BF 14F0D COMPARE UART_data[sF], character_CR[0D] ;test for last character + 0C0 2B000 RETURN Z + 0C1 18101 ADD s1, 01 ;move to next character + 0C2 340BD JUMP next_char_tx[0BD] + 0C3 ; + 0C3 ; + 0C3 ;Receive ASCII string from UART + 0C3 ; + 0C3 ;An ASCII string will be read from the UART and stored in scratch pad memory + 0C3 ;commencing at the location specified by a constant named 'string_start'. + 0C3 ;The string will will have a maximum length of 16 characters including a + 0C3 ;carriage return (0D) denoting the end of the string. + 0C3 ; + 0C3 ;As each character is read, it is echoed to the UART transmitter. + 0C3 ;Some minor editing is supported using backspace (BS=08) which is used + 0C3 ;to adjust what is stored in scratch pad memory and adjust the display + 0C3 ;on the terminal screen using characters sent to the UART transmitter. + 0C3 ; + 0C3 ;A test is made for the receiver FIFO becoming full. A full status is treated as + 0C3 ;a potential error situation and will result in a 'Overflow Error' message being + 0C3 ;transmitted to the UART, the receiver FIFO being purged of all data and an + 0C3 ;empty string being stored (carriage return at first location). + 0C3 ; + 0C3 ;Registers used s0, s1, s2 and 'UART_data'. + 0C3 ; + 0C3 00120 receive_string: LOAD s1, string_start[20] ;locate start of string + 0C4 01210 LOAD s2, s1 ;compute 16 character address + 0C5 18210 ADD s2, 10 + 0C6 04000 receive_full_test: INPUT s0, UART_status_port[00] ;test Rx_FIFO buffer for full + 0C7 12008 TEST s0, rx_full[08] + 0C8 354DB JUMP NZ, read_error[0DB] + 0C9 30095 CALL read_from_UART[095] ;obtain and echo character + 0CA 2FF10 STORE UART_data[sF], (s1) ;write to memory + 0CB 14F0D COMPARE UART_data[sF], character_CR[0D] ;test for end of string + 0CC 2B000 RETURN Z + 0CD 14F08 COMPARE UART_data[sF], character_BS[08] ;test for back space + 0CE 350D3 JUMP Z, BS_edit[0D3] + 0CF 18101 ADD s1, 01 ;increment memory pointer + 0D0 15120 COMPARE s1, s2 ;test for pointer exceeding 16 characters + 0D1 354C6 JUMP NZ, receive_full_test[0C6] ;next character + 0D2 300EA CALL send_backspace[0EA] ;hold end of string position on terminal display + 0D3 1C101 BS_edit: SUB s1, 01 ;memory pointer back one + 0D4 14120 COMPARE s1, string_start[20] ;test for under flow + 0D5 358D9 JUMP C, string_start_again[0D9] + 0D6 300E7 CALL send_space[0E7] ;clear character at current position + 0D7 300EA CALL send_backspace[0EA] ;position cursor + 0D8 340C6 JUMP receive_full_test[0C6] ;next character + 0D9 30122 string_start_again: CALL send_greater_than[122] ;restore '>' at prompt + 0DA 340C3 JUMP receive_string[0C3] ;begin again + 0DB ;Receiver buffer overflow condition + 0DB 300E4 read_error: CALL send_CR[0E4] ;Transmit error message + 0DC 2EF20 STORE UART_data[sF], string_start[20] ;empty string in memory (start with CR) + 0DD 300FA CALL send_Overflow_Error[0FA] + 0DE 300E4 CALL send_CR[0E4] + 0DF 04000 clear_UART_Rx_loop: INPUT s0, UART_status_port[00] ;test Rx_FIFO buffer for data + 0E0 12010 TEST s0, rx_data_present[10] + 0E1 2B000 RETURN Z ;finish when buffer is empty + 0E2 04F01 INPUT UART_data[sF], UART_read_port[01] ;read from FIFO and ignore + 0E3 340DF JUMP clear_UART_Rx_loop[0DF] + 0E4 ; + 0E4 ; + 0E4 ; + 0E4 ;Send Carriage Return to the UART + 0E4 ; + 0E4 00F0D send_CR: LOAD UART_data[sF], character_CR[0D] + 0E5 3009D CALL send_to_UART[09D] + 0E6 2A000 RETURN + 0E7 ; + 0E7 ; + 0E7 ; + 0E7 ;Send a space to the UART + 0E7 ; + 0E7 00F20 send_space: LOAD UART_data[sF], character_space[20] + 0E8 3009D CALL send_to_UART[09D] + 0E9 2A000 RETURN + 0EA ; + 0EA ; + 0EA ;Send a back space to the UART + 0EA ; + 0EA 00F08 send_backspace: LOAD UART_data[sF], character_BS[08] + 0EB 3009D CALL send_to_UART[09D] + 0EC 2A000 RETURN + 0ED ; + 0ED ;Send 'Syntax Error' to the UART + 0ED ; + 0ED 00F53 send_Syntax_Error: LOAD UART_data[sF], character_S[53] + 0EE 3009D CALL send_to_UART[09D] + 0EF 00F79 LOAD UART_data[sF], character_y[79] + 0F0 3009D CALL send_to_UART[09D] + 0F1 00F6E LOAD UART_data[sF], character_n[6E] + 0F2 3009D CALL send_to_UART[09D] + 0F3 00F74 LOAD UART_data[sF], character_t[74] + 0F4 3009D CALL send_to_UART[09D] + 0F5 00F61 LOAD UART_data[sF], character_a[61] + 0F6 3009D CALL send_to_UART[09D] + 0F7 00F78 LOAD UART_data[sF], character_x[78] + 0F8 3009D CALL send_to_UART[09D] + 0F9 3410A JUMP send_space_Error[10A] + 0FA ; + 0FA ;Send 'Overflow Error' to the UART + 0FA ; + 0FA 00F4F send_Overflow_Error: LOAD UART_data[sF], character_O[4F] + 0FB 3009D CALL send_to_UART[09D] + 0FC 00F76 LOAD UART_data[sF], character_v[76] + 0FD 3009D CALL send_to_UART[09D] + 0FE 00F65 LOAD UART_data[sF], character_e[65] + 0FF 3009D CALL send_to_UART[09D] + 100 00F72 LOAD UART_data[sF], character_r[72] + 101 3009D CALL send_to_UART[09D] + 102 00F66 LOAD UART_data[sF], character_f[66] + 103 3009D CALL send_to_UART[09D] + 104 00F6C LOAD UART_data[sF], character_l[6C] + 105 3009D CALL send_to_UART[09D] + 106 00F6F LOAD UART_data[sF], character_o[6F] + 107 3009D CALL send_to_UART[09D] + 108 00F77 LOAD UART_data[sF], character_w[77] + 109 3009D CALL send_to_UART[09D] + 10A 300E7 send_space_Error: CALL send_space[0E7] + 10B ; + 10B ;Send 'Error' to the UART + 10B ; + 10B 00F45 send_Error: LOAD UART_data[sF], character_E[45] + 10C 3009D CALL send_to_UART[09D] + 10D 00F72 LOAD UART_data[sF], character_r[72] + 10E 3009D CALL send_to_UART[09D] + 10F 3009D CALL send_to_UART[09D] + 110 00F6F LOAD UART_data[sF], character_o[6F] + 111 3009D CALL send_to_UART[09D] + 112 00F72 LOAD UART_data[sF], character_r[72] + 113 3009D CALL send_to_UART[09D] + 114 2A000 RETURN + 115 ; + 115 ;Send 'KCPSM3>' prompt to the UART + 115 ; + 115 300E4 send_prompt: CALL send_CR[0E4] ;start new line + 116 00F4B LOAD UART_data[sF], character_K[4B] + 117 3009D CALL send_to_UART[09D] + 118 00F43 LOAD UART_data[sF], character_C[43] + 119 3009D CALL send_to_UART[09D] + 11A 00F50 LOAD UART_data[sF], character_P[50] + 11B 3009D CALL send_to_UART[09D] + 11C 00F53 LOAD UART_data[sF], character_S[53] + 11D 3009D CALL send_to_UART[09D] + 11E 00F4D LOAD UART_data[sF], character_M[4D] + 11F 3009D CALL send_to_UART[09D] + 120 00F33 LOAD UART_data[sF], character_3[33] + 121 3009D CALL send_to_UART[09D] + 122 ; + 122 ;Send '>' character to the UART + 122 ; + 122 00F3E send_greater_than: LOAD UART_data[sF], character_greater_than[3E] + 123 3009D CALL send_to_UART[09D] + 124 2A000 RETURN + 125 ; + 125 ;Send 'Invalid' string to the UART + 125 ; + 125 00F49 send_Invalid: LOAD UART_data[sF], character_I[49] + 126 3009D CALL send_to_UART[09D] + 127 00F6E LOAD UART_data[sF], character_n[6E] + 128 3009D CALL send_to_UART[09D] + 129 00F76 LOAD UART_data[sF], character_v[76] + 12A 3009D CALL send_to_UART[09D] + 12B 00F61 LOAD UART_data[sF], character_a[61] + 12C 3009D CALL send_to_UART[09D] + 12D 00F6C LOAD UART_data[sF], character_l[6C] + 12E 3009D CALL send_to_UART[09D] + 12F 00F69 LOAD UART_data[sF], character_i[69] + 130 3009D CALL send_to_UART[09D] + 131 00F64 LOAD UART_data[sF], character_d[64] + 132 3009D CALL send_to_UART[09D] + 133 2A000 RETURN + 134 ; + 134 ;Send 'Time' string to the UART + 134 ; + 134 00F54 send_Time: LOAD UART_data[sF], character_T[54] + 135 3009D CALL send_to_UART[09D] + 136 00F69 LOAD UART_data[sF], character_i[69] + 137 3009D CALL send_to_UART[09D] + 138 00F6D LOAD UART_data[sF], character_m[6D] + 139 3009D CALL send_to_UART[09D] + 13A 00F65 LOAD UART_data[sF], character_e[65] + 13B 3009D CALL send_to_UART[09D] + 13C 2A000 RETURN + 13D ; + 13D ;Send 'Alarm' string to the UART + 13D ; + 13D 00F41 send_Alarm: LOAD UART_data[sF], character_A[41] + 13E 3009D CALL send_to_UART[09D] + 13F 00F6C LOAD UART_data[sF], character_l[6C] + 140 3009D CALL send_to_UART[09D] + 141 00F61 LOAD UART_data[sF], character_a[61] + 142 3009D CALL send_to_UART[09D] + 143 00F72 LOAD UART_data[sF], character_r[72] + 144 3009D CALL send_to_UART[09D] + 145 00F6D LOAD UART_data[sF], character_m[6D] + 146 3009D CALL send_to_UART[09D] + 147 2A000 RETURN + 148 ; + 148 ;Send 'OFF' string to the UART + 148 ; + 148 00F4F send_OFF: LOAD UART_data[sF], character_O[4F] + 149 3009D CALL send_to_UART[09D] + 14A 00F46 LOAD UART_data[sF], character_F[46] + 14B 3009D CALL send_to_UART[09D] + 14C 3009D CALL send_to_UART[09D] + 14D 2A000 RETURN + 14E ; + 14E ;Send 'ON' string to the UART + 14E ; + 14E 00F4F send_ON: LOAD UART_data[sF], character_O[4F] + 14F 3009D CALL send_to_UART[09D] + 150 00F4E LOAD UART_data[sF], character_N[4E] + 151 3009D CALL send_to_UART[09D] + 152 2A000 RETURN + 153 ; + 153 ;Send 'Active' string to the UART + 153 ; + 153 00F41 send_Active: LOAD UART_data[sF], character_A[41] + 154 3009D CALL send_to_UART[09D] + 155 00F63 LOAD UART_data[sF], character_c[63] + 156 3009D CALL send_to_UART[09D] + 157 00F74 LOAD UART_data[sF], character_t[74] + 158 3009D CALL send_to_UART[09D] + 159 00F69 LOAD UART_data[sF], character_i[69] + 15A 3009D CALL send_to_UART[09D] + 15B 00F76 LOAD UART_data[sF], character_v[76] + 15C 3009D CALL send_to_UART[09D] + 15D 00F65 LOAD UART_data[sF], character_e[65] + 15E 3009D CALL send_to_UART[09D] + 15F 2A000 RETURN + 160 ; + 160 ; + 160 ;Convert time to ASCII string in scratch pad memory. + 160 ; + 160 ;The time to converted must be stored in 3 scratch pad memory locations as + 160 ;defined below. A register named 'store_pointer' must provide the address of + 160 ;first location. + 160 ; + 160 ; Address Data + 160 ; + 160 ; store_pointer ----> hours + 160 ; store_pointer + 1 ----> minutes + 160 ; store_pointer + 1 ----> seconds + 160 ; + 160 ;The resulting ASCII string will be stored in scratch pad memory starting at + 160 ;a location specified by a constant named 'string_start'. The string will + 160 ;take the format hh:mm:ss and end with a carriage return. + 160 ; + 160 ;Registers used s0, s1, s2 and 'store_pointer'. + 160 ; + 160 00220 time_to_ASCII: LOAD s2, string_start[20] ;location for string + 161 070E0 FETCH s0, (store_pointer)[(sE)] ;read hours value + 162 3017E CALL decimal_to_ASCII[17E] ;convert to ASCII + 163 2F120 STORE s1, (s2) ;write hours to string + 164 18201 ADD s2, 01 + 165 2F020 STORE s0, (s2) + 166 18201 ADD s2, 01 + 167 0003A LOAD s0, character_colon[3A] ;write ':' to string + 168 2F020 STORE s0, (s2) + 169 18201 ADD s2, 01 + 16A 18E01 ADD store_pointer[sE], 01 ;move to minutes + 16B 070E0 FETCH s0, (store_pointer)[(sE)] ;read minutes value + 16C 3017E CALL decimal_to_ASCII[17E] ;convert to ASCII + 16D 2F120 STORE s1, (s2) ;write minutes to string + 16E 18201 ADD s2, 01 + 16F 2F020 STORE s0, (s2) + 170 18201 ADD s2, 01 + 171 0003A LOAD s0, character_colon[3A] ;write ':' to string + 172 2F020 STORE s0, (s2) + 173 18201 ADD s2, 01 + 174 18E01 ADD store_pointer[sE], 01 ;move to seconds + 175 070E0 FETCH s0, (store_pointer)[(sE)] ;read seconds value + 176 3017E CALL decimal_to_ASCII[17E] ;convert to ASCII + 177 2F120 STORE s1, (s2) ;write seconds to string + 178 18201 ADD s2, 01 + 179 2F020 STORE s0, (s2) + 17A 18201 ADD s2, 01 + 17B 0000D LOAD s0, character_CR[0D] ;finish string with carriage return + 17C 2F020 STORE s0, (s2) + 17D 2A000 RETURN + 17E ; + 17E ;Convert value provided in register s0 into ASCII characters + 17E ; + 17E ;The value provided must in the range 0 to 99 and will be converted into + 17E ;two ASCII characters. + 17E ; The number of 'tens' will be representd by an ASCII character returned in register s1. + 17E ; The number of 'units' will be representd by an ASCII character returned in register s0. + 17E ; + 17E ;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + 17E ;the actual decimal value. + 17E ; + 17E ;Registers used s0 and s1. + 17E ; + 17E 00130 decimal_to_ASCII: LOAD s1, 30 ;load 'tens' counter with ASCII for '0' + 17F 18101 test_for_ten: ADD s1, 01 ;increment 'tens' value + 180 1C00A SUB s0, 0A ;try to subtract 10 from the supplied value + 181 35D7F JUMP NC, test_for_ten[17F] ;repeat if subtraction was possible without underflow. + 182 1C101 SUB s1, 01 ;'tens' value one less ten due to underflow + 183 1803A ADD s0, 3A ;restore units value (the remainder) and convert to ASCII + 184 2A000 RETURN + 185 ; + 185 ; + 185 ; + 185 ; + 185 ;Real Time Clock + 185 ; + 185 ;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + 185 ;micro-seconds have elapsed since the last update. This allows for just over 65ms between + 185 ;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + 185 ;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + 185 ;is used to update the real time hours, minutes and seconds clock held in scratch pad + 185 ;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + 185 ; + 185 ;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + 185 ;memory during the routine and restored before returning. + 185 ; + 185 ;Useful constants for real time clock operations + 185 ; + 185 CONSTANT count_1000_lsb, E8 ;lower 8-bits of 1000 count value + 185 CONSTANT count_1000_msb, 03 ;upper 8-bits of 1000 count value + 185 CONSTANT hours_in_a_day, 18 ;24 hours in a day + 185 CONSTANT minutes_in_an_hour, 3C ;60 minutes in an hour + 185 CONSTANT seconds_in_a_minute, 3C ;60 seconds in a minute + 185 ; + 185 2E010 update_time: STORE s0, time_preserve0[10] ;preserve contents of registers used during routine + 186 2E111 STORE s1, time_preserve1[11] + 187 2E212 STORE s2, time_preserve2[12] + 188 2E313 STORE s3, time_preserve3[13] + 189 2E414 STORE s4, time_preserve4[14] + 18A 2E515 STORE s5, time_preserve5[15] + 18B ; + 18B 06200 FETCH s2, us_time_stamp_lsb[00] ;read the previous 'us' time stamp into [s3,s2] + 18C 06301 FETCH s3, us_time_stamp_msb[01] + 18D 3C000 DISABLE INTERRUPT ;Read and store current 'us' time stamp provided by the interrupt + 18E 2ED00 STORE int_counter_lsb[sD], us_time_stamp_lsb[00] ;counter. Interrupts are disabled to ensure that both bytes relate + 18F 2EC01 STORE int_counter_msb[sC], us_time_stamp_msb[01] ;to the same count value. + 190 3C001 ENABLE INTERRUPT + 191 06400 FETCH s4, us_time_stamp_lsb[00] ;read the new 'us' time stamp in [s5,s4] + 192 06501 FETCH s5, us_time_stamp_msb[01] ; + 193 1D420 SUB s4, s2 ;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + 194 1F530 SUBCY s5, s3 ; (This works correctly even if counter has rolled over) + 195 06202 FETCH s2, us_time_lsb[02] ;read current 'us' time into [s3,s2] + 196 06303 FETCH s3, us_time_msb[03] + 197 19240 ADD s2, s4 ;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + 198 1B350 ADDCY s3, s5 + 199 ;determine how many 1000us (1ms) units there are (if any) in current 'us' time + 199 00000 LOAD s0, 00 ;reset 'ms' counter + 19A 1C2E8 test_1000us: SUB s2, count_1000_lsb[E8] ;subtract 1000 from [s3,s2] + 19B 1E303 SUBCY s3, count_1000_msb[03] + 19C 3599F JUMP C, store_us_time[19F] ;Carry indicates [s3,s2] was less than 1000us + 19D 18001 ADD s0, 01 ;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + 19E 3419A JUMP test_1000us[19A] ;repeat to see if more than 1ms has elapsed + 19F 182E8 store_us_time: ADD s2, count_1000_lsb[E8] ;add 1000 to restore 'us' value + 1A0 1A303 ADDCY s3, count_1000_msb[03] + 1A1 2E202 STORE s2, us_time_lsb[02] ;store the current value of 'us' + 1A2 2E303 STORE s3, us_time_msb[03] + 1A3 ;s0 holds the number of 'ms' elapsed since last update (if any). + 1A3 06204 FETCH s2, ms_time_lsb[04] ;read current 'ms' time into [s3,s2] + 1A4 06305 FETCH s3, ms_time_msb[05] + 1A5 19200 ADD s2, s0 ;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + 1A6 1A300 ADDCY s3, 00 + 1A7 ;determine if there are now more than 1000ms to form 1 second. + 1A7 00000 LOAD s0, 00 ;reset 'second' counter + 1A8 1C2E8 SUB s2, count_1000_lsb[E8] ;subtract 1000 from [s3,s2] + 1A9 1E303 SUBCY s3, count_1000_msb[03] + 1AA 359AD JUMP C, restore_ms_time[1AD] ;Carry indicates [s3,s2] was less than 1000ms + 1AB 18001 ADD s0, 01 ;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + 1AC 341AF JUMP store_ms_time[1AF] ;new value of 'ms' is remainder of subtraction + 1AD 182E8 restore_ms_time: ADD s2, count_1000_lsb[E8] ;add 1000 to restore 'ms' value + 1AE 1A303 ADDCY s3, count_1000_msb[03] + 1AF 2E204 store_ms_time: STORE s2, ms_time_lsb[04] ;store the current value of 'ms' + 1B0 2E305 STORE s3, ms_time_msb[05] + 1B1 ;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + 1B1 06108 FETCH s1, real_time_seconds[08] ;read seconds + 1B2 19100 ADD s1, s0 ;add one second if required by s0 + 1B3 1413C COMPARE s1, seconds_in_a_minute[3C] ;test for 1 minute + 1B4 351B7 JUMP Z, inc_minutes[1B7] + 1B5 2E108 STORE s1, real_time_seconds[08] ;store updated seconds + 1B6 341C9 JUMP time_update_complete[1C9] + 1B7 00100 inc_minutes: LOAD s1, 00 ;seconds become zero + 1B8 2E108 STORE s1, real_time_seconds[08] + 1B9 06107 FETCH s1, real_time_minutes[07] ;read minutes + 1BA 18101 ADD s1, 01 ;increment minutes + 1BB 1413C COMPARE s1, minutes_in_an_hour[3C] ;test for 1 hour + 1BC 351BF JUMP Z, inc_hours[1BF] + 1BD 2E107 STORE s1, real_time_minutes[07] ;store updated minutes + 1BE 341C9 JUMP time_update_complete[1C9] + 1BF 00100 inc_hours: LOAD s1, 00 ;minutes become zero + 1C0 2E107 STORE s1, real_time_minutes[07] + 1C1 06106 FETCH s1, real_time_hours[06] ;read hours + 1C2 18101 ADD s1, 01 ;increment hours + 1C3 14118 COMPARE s1, hours_in_a_day[18] ;test for 24 hours + 1C4 351C7 JUMP Z, reset_hours[1C7] + 1C5 2E106 STORE s1, real_time_hours[06] ;store updated hours + 1C6 341C9 JUMP time_update_complete[1C9] + 1C7 00100 reset_hours: LOAD s1, 00 ;hours become zero + 1C8 2E106 STORE s1, real_time_hours[06] + 1C9 ; + 1C9 ;With the time updated, there is then a test for time=alarm time + 1C9 ; + 1C9 06006 time_update_complete: FETCH s0, real_time_hours[06] + 1CA 06109 FETCH s1, alarm_time_hours[09] ;compare hours + 1CB 15010 COMPARE s0, s1 + 1CC 355DB JUMP NZ, finish_update[1DB] + 1CD 06007 FETCH s0, real_time_minutes[07] ;compare minutes + 1CE 0610A FETCH s1, alarm_time_minutes[0A] + 1CF 15010 COMPARE s0, s1 + 1D0 355DB JUMP NZ, finish_update[1DB] + 1D1 06008 FETCH s0, real_time_seconds[08] ;compare seconds + 1D2 0610B FETCH s1, alarm_time_seconds[0B] + 1D3 15010 COMPARE s0, s1 + 1D4 355DB JUMP NZ, finish_update[1DB] + 1D5 0600C FETCH s0, alarm_status[0C] ;test if alarm is turned on + 1D6 12002 TEST s0, alarm_armed[02] + 1D7 351DB JUMP Z, finish_update[1DB] ;alarm was off + 1D8 0C001 OR s0, alarm_active[01] ;activate alarm + 1D9 2E00C STORE s0, alarm_status[0C] + 1DA 300A4 CALL alarm_drive[0A4] + 1DB 06010 finish_update: FETCH s0, time_preserve0[10] ;restore the register contents + 1DC 06111 FETCH s1, time_preserve1[11] + 1DD 06212 FETCH s2, time_preserve2[12] + 1DE 06313 FETCH s3, time_preserve3[13] + 1DF 06414 FETCH s4, time_preserve4[14] + 1E0 06515 FETCH s5, time_preserve5[15] + 1E1 2A000 RETURN + 1E2 ; + 1E2 ;Convert character to upper case + 1E2 ; + 1E2 ;The character supplied in register s0. + 1E2 ;If the character is in the range 'a' to 'z', it is converted + 1E2 ;to the equivalent upper case character in the range 'A' to 'Z'. + 1E2 ;All other characters remain unchanged. + 1E2 ; + 1E2 ;Registers used s0. + 1E2 ; + 1E2 14061 upper_case: COMPARE s0, 61 ;eliminate character codes below 'a' (61 hex) + 1E3 2B800 RETURN C + 1E4 1407B COMPARE s0, 7B ;eliminate character codes above 'z' (7A hex) + 1E5 2BC00 RETURN NC + 1E6 0A0DF AND s0, DF ;mask bit5 to convert to upper case + 1E7 2A000 RETURN + 1E8 ; + 1E8 ; + 1E8 ;Convert character '0' to '9' to numerical value in range 0 to 9 + 1E8 ; + 1E8 ;The character supplied in register s0. If the character is in the + 1E8 ;range '0' to '9', it is converted to the equivalent decimal value. + 1E8 ;Characters not in the range '0' to '9' are signified by the return + 1E8 ;with the CARRY flag set. + 1E8 ; + 1E8 ;Registers used s0. + 1E8 ; + 1E8 180C6 1char_to_value: ADD s0, C6 ;reject character codes above '9' (39 hex) + 1E9 2B800 RETURN C ;carry flag is set + 1EA 1C0F6 SUB s0, F6 ;reject character codes below '0' (30 hex) + 1EB 2A000 RETURN ;carry is set if value not in range + 1EC ; + 1EC ; + 1EC ;Determine the numerical value of a two character decimal string held in + 1EC ;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + 1EC ; + 1EC ;The string must be stored as in two consecutive memory locations and the + 1EC ;location of the first (tens) character supplied in the s1 register. + 1EC ;The result is provided in register s2. Strings not using characters in the + 1EC ;range '0' to '9' are signified by the return with the CARRY flag set. + 1EC ; + 1EC ;Registers used s0, s1 and s2. + 1EC ; + 1EC 07010 2char_to_value: FETCH s0, (s1) ;read 'tens' character + 1ED 301E8 CALL 1char_to_value[1E8] ;convert to numerical value + 1EE 2B800 RETURN C ;bad character - CARRY set + 1EF 01200 LOAD s2, s0 + 1F0 20206 SL0 s2 ;multiply 'tens' value by 10 (0A hex) + 1F1 20206 SL0 s2 + 1F2 19200 ADD s2, s0 + 1F3 20206 SL0 s2 + 1F4 18101 ADD s1, 01 ;read 'units' character + 1F5 07010 FETCH s0, (s1) + 1F6 301E8 CALL 1char_to_value[1E8] ;convert to numerical value + 1F7 2B800 RETURN C ;bad character - CARRY set + 1F8 19200 ADD s2, s0 ;add units to result and clear CARRY flag + 1F9 2A000 RETURN + 1FA ; + 1FA ; + 1FA ;Interrupt service routine (ISR) + 1FA ; + 1FA ;The interrupt is used to increment a 16-bit counter formed with two registers + 1FA ;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + 1FA ;of micro-seconds elapsed. The counter is 'free running' in that it will count + 1FA ;up to 65,535 and then roll over to zero. The count value is then used in other + 1FA ;parts of the program as required and where it is less time critical. + 1FA ; + 1FA ;The ISR only uses the specified counter registers + 1FA ; + 3FC ADDRESS 3FC + 3FC 18D01 ISR: ADD int_counter_lsb[sD], 01 ;add 1us to 16-bit counter + 3FD 1AC00 ADDCY int_counter_msb[sC], 00 + 3FE 38001 RETURNI ENABLE + 3FF ; + 3FF ;Interrupt vector + 3FF ; + 3FF ADDRESS 3FF + 3FF 343FC JUMP ISR[3FC] + 3FF ; + 3FF ; + 3FF ;Useful constants + 3FF ; + 3FF ; + 3FF ;ASCII table + 3FF ; + 3FF CONSTANT character_a, 61 + 3FF CONSTANT character_b, 62 + 3FF CONSTANT character_c, 63 + 3FF CONSTANT character_d, 64 + 3FF CONSTANT character_e, 65 + 3FF CONSTANT character_f, 66 + 3FF CONSTANT character_g, 67 + 3FF CONSTANT character_h, 68 + 3FF CONSTANT character_i, 69 + 3FF CONSTANT character_j, 6A + 3FF CONSTANT character_k, 6B + 3FF CONSTANT character_l, 6C + 3FF CONSTANT character_m, 6D + 3FF CONSTANT character_n, 6E + 3FF CONSTANT character_o, 6F + 3FF CONSTANT character_p, 70 + 3FF CONSTANT character_q, 71 + 3FF CONSTANT character_r, 72 + 3FF CONSTANT character_s, 73 + 3FF CONSTANT character_t, 74 + 3FF CONSTANT character_u, 75 + 3FF CONSTANT character_v, 76 + 3FF CONSTANT character_w, 77 + 3FF CONSTANT character_x, 78 + 3FF CONSTANT character_y, 79 + 3FF CONSTANT character_z, 7A + 3FF CONSTANT character_A, 41 + 3FF CONSTANT character_B, 42 + 3FF CONSTANT character_C, 43 + 3FF CONSTANT character_D, 44 + 3FF CONSTANT character_E, 45 + 3FF CONSTANT character_F, 46 + 3FF CONSTANT character_G, 47 + 3FF CONSTANT character_H, 48 + 3FF CONSTANT character_I, 49 + 3FF CONSTANT character_J, 4A + 3FF CONSTANT character_K, 4B + 3FF CONSTANT character_L, 4C + 3FF CONSTANT character_M, 4D + 3FF CONSTANT character_N, 4E + 3FF CONSTANT character_O, 4F + 3FF CONSTANT character_P, 50 + 3FF CONSTANT character_Q, 51 + 3FF CONSTANT character_R, 52 + 3FF CONSTANT character_S, 53 + 3FF CONSTANT character_T, 54 + 3FF CONSTANT character_U, 55 + 3FF CONSTANT character_V, 56 + 3FF CONSTANT character_W, 57 + 3FF CONSTANT character_X, 58 + 3FF CONSTANT character_Y, 59 + 3FF CONSTANT character_Z, 5A + 3FF CONSTANT character_0, 30 + 3FF CONSTANT character_1, 31 + 3FF CONSTANT character_2, 32 + 3FF CONSTANT character_3, 33 + 3FF CONSTANT character_4, 34 + 3FF CONSTANT character_5, 35 + 3FF CONSTANT character_6, 36 + 3FF CONSTANT character_7, 37 + 3FF CONSTANT character_8, 38 + 3FF CONSTANT character_9, 39 + 3FF CONSTANT character_colon, 3A + 3FF CONSTANT character_semi_colon, 3B + 3FF CONSTANT character_less_than, 3C + 3FF CONSTANT character_greater_than, 3E + 3FF CONSTANT character_equals, 3D + 3FF CONSTANT character_space, 20 + 3FF CONSTANT character_CR, 0D ;carriage return + 3FF CONSTANT character_question, 3F ;'?' + 3FF CONSTANT character_dollar, 24 + 3FF CONSTANT character_BS, 08 ;Back Space command character + 3FF ; diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.M b/projects/PicoBlaze/ise/Assembler/UCLOCK.M new file mode 100644 index 0000000..c4c35be --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.M @@ -0,0 +1,69 @@ +function bits = fill_uclock_program_store() + bits = [ ... + 0, 188416, 188417, 188418, 188419, 188420, 188421, 188422, 188423, 188424, 188425, 188426, 188427, 188428, 196772, 3328, ... + 3072, 245761, 196885, 196803, 288, 196753, 81933, 217106, 82004, 217118, 81985, 217143, 196845, 217106, 196753, 81993, ... + 218140, 196753, 81997, 218140, 196753, 81989, 218140, 196753, 81933, 218156, 196776, 213010, 81952, 218140, 196717, 219154, ... + 189958, 189703, 189448, 188420, 188421, 196776, 213010, 196753, 81996, 218140, 196753, 81985, 218140, 196753, 82002, 218140, ... + 196753, 81997, 218140, 196753, 81933, 218184, 196780, 213010, 81952, 218140, 196753, 81999, 217173, 114945, 196717, 219154, ... + 189961, 189706, 189451, 196780, 213010, 196753, 81998, 218208, 196753, 81933, 218140, 24588, 49154, 188428, 196780, 213010, ... + 81990, 218140, 196753, 81990, 218140, 196753, 81933, 218140, 0, 188428, 196772, 196780, 213010, 197100, 219275, 5664, ... + 98561, 196753, 81978, 218251, 197100, 219275, 5408, 98561, 196753, 81978, 218251, 197100, 219275, 5152, 98561, 196753, ... + 81933, 218251, 83480, 220299, 83260, 220299, 83004, 220299, 0, 131086, 172032, 196901, 196839, 196916, 1, 131086, ... + 172032, 28688, 197090, 98561, 172032, 16384, 73744, 218266, 196997, 213141, 20225, 196765, 172032, 16384, 73730, 217250, ... + 196997, 213149, 184065, 172032, 24588, 40961, 180224, 172032, 3590, 196960, 196796, 172032, 3593, 196960, 196796, 196925, ... + 196839, 24588, 73729, 217270, 196947, 172032, 73730, 217274, 196942, 172032, 196936, 172032, 288, 32528, 196765, 85773, ... + 176128, 98561, 213181, 288, 4624, 98832, 16384, 73736, 218331, 196757, 196368, 85773, 176128, 85768, 217299, 98561, ... + 86304, 218310, 196842, 114945, 82208, 219353, 196839, 196842, 213190, 196898, 213187, 196836, 192288, 196858, 196836, 16384, ... + 73744, 176128, 20225, 213215, 3853, 196765, 172032, 3872, 196765, 172032, 3848, 196765, 172032, 3923, 196765, 3961, ... + 196765, 3950, 196765, 3956, 196765, 3937, 196765, 3960, 196765, 213258, 3919, 196765, 3958, 196765, 3941, 196765, ... + 3954, 196765, 3942, 196765, 3948, 196765, 3951, 196765, 3959, 196765, 196839, 3909, 196765, 3954, 196765, 196765, ... + 3951, 196765, 3954, 196765, 172032, 196836, 3915, 196765, 3907, 196765, 3920, 196765, 3923, 196765, 3917, 196765, ... + 3891, 196765, 3902, 196765, 172032, 3913, 196765, 3950, 196765, 3958, 196765, 3937, 196765, 3948, 196765, 3945, ... + 196765, 3940, 196765, 172032, 3924, 196765, 3945, 196765, 3949, 196765, 3941, 196765, 172032, 3905, 196765, 3948, ... + 196765, 3937, 196765, 3954, 196765, 3949, 196765, 172032, 3919, 196765, 3910, 196765, 196765, 172032, 3919, 196765, ... + 3918, 196765, 172032, 3905, 196765, 3939, 196765, 3956, 196765, 3945, 196765, 3958, 196765, 3941, 196765, 172032, ... + 544, 28896, 196990, 192800, 98817, 192544, 98817, 58, 192544, 98817, 101889, 28896, 196990, 192800, 98817, 192544, ... + 98817, 58, 192544, 98817, 101889, 28896, 196990, 192800, 98817, 192544, 98817, 13, 192544, 172032, 304, 98561, ... + 114698, 220543, 114945, 98362, 172032, 188432, 188689, 188946, 189203, 189460, 189717, 25088, 25345, 245760, 191744, 191489, ... + 245761, 25600, 25857, 119840, 128304, 25090, 25347, 102976, 111440, 0, 115432, 123651, 219551, 98305, 213402, 99048, ... + 107267, 188930, 189187, 25092, 25349, 102912, 107264, 0, 115432, 123651, 219565, 98305, 213423, 99048, 107267, 188932, ... + 189189, 24840, 102656, 82236, 217527, 188680, 213449, 256, 188680, 24839, 98561, 82236, 217535, 188679, 213449, 256, ... + 188679, 24838, 98561, 82200, 217543, 188678, 213449, 256, 188678, 24582, 24841, 86032, 218587, 24583, 24842, 86032, ... + 218587, 24584, 24843, 86032, 218587, 24588, 73730, 217563, 49153, 188428, 196772, 24592, 24849, 25106, 25363, 25620, ... + 25877, 172032, 82017, 178176, 82043, 179200, 41183, 172032, 98502, 178176, 114934, 172032, 28688, 197096, 178176, 4608, ... + 131590, 131590, 102912, 131590, 98561, 28688, 197096, 178176, 102912, 172032, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101633, 109568, 229377, 214012, ... + ]; + + return; diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.MEM b/projects/PicoBlaze/ise/Assembler/UCLOCK.MEM new file mode 100644 index 0000000..9cd8bc9 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.MEM @@ -0,0 +1,1025 @@ +@00000000 +00000 +2E000 +2E001 +2E002 +2E003 +2E004 +2E005 +2E006 +2E007 +2E008 +2E009 +2E00A +2E00B +2E00C +300A4 +00D00 +00C00 +3C001 +30115 +300C3 +00120 +30091 +1400D +35012 +14054 +3501E +14041 +35037 +300ED +35012 +30091 +14049 +3541C +30091 +1404D +3541C +30091 +14045 +3541C +30091 +1400D +3542C +300A8 +34012 +14020 +3541C +3006D +35812 +2E606 +2E507 +2E408 +2E004 +2E005 +300A8 +34012 +30091 +1404C +3541C +30091 +14041 +3541C +30091 +14052 +3541C +30091 +1404D +3541C +30091 +1400D +35448 +300AC +34012 +14020 +3541C +30091 +1404F +35055 +1C101 +3006D +35812 +2E609 +2E50A +2E40B +300AC +34012 +30091 +1404E +35460 +30091 +1400D +3541C +0600C +0C002 +2E00C +300AC +34012 +14046 +3541C +30091 +14046 +3541C +30091 +1400D +3541C +00000 +2E00C +300A4 +300AC +34012 +301EC +3588B +01620 +18101 +30091 +1403A +3548B +301EC +3588B +01520 +18101 +30091 +1403A +3548B +301EC +3588B +01420 +18101 +30091 +1400D +3548B +14618 +35C8B +1453C +35C8B +1443C +35C8B +00000 +2000E +2A000 +30125 +300E7 +30134 +00001 +2000E +2A000 +07010 +301E2 +18101 +2A000 +04000 +12010 +3549A +30185 +34095 +04F01 +3009D +2A000 +04000 +12002 +350A2 +30185 +3409D +2CF01 +2A000 +0600C +0A001 +2C000 +2A000 +00E06 +30160 +300BC +2A000 +00E09 +30160 +300BC +3013D +300E7 +0600C +12001 +350B6 +30153 +2A000 +12002 +350BA +3014E +2A000 +30148 +2A000 +00120 +07F10 +3009D +14F0D +2B000 +18101 +340BD +00120 +01210 +18210 +04000 +12008 +354DB +30095 +2FF10 +14F0D +2B000 +14F08 +350D3 +18101 +15120 +354C6 +300EA +1C101 +14120 +358D9 +300E7 +300EA +340C6 +30122 +340C3 +300E4 +2EF20 +300FA +300E4 +04000 +12010 +2B000 +04F01 +340DF +00F0D +3009D +2A000 +00F20 +3009D +2A000 +00F08 +3009D +2A000 +00F53 +3009D +00F79 +3009D +00F6E +3009D +00F74 +3009D +00F61 +3009D +00F78 +3009D +3410A +00F4F +3009D +00F76 +3009D +00F65 +3009D +00F72 +3009D +00F66 +3009D +00F6C +3009D +00F6F +3009D +00F77 +3009D +300E7 +00F45 +3009D +00F72 +3009D +3009D +00F6F +3009D +00F72 +3009D +2A000 +300E4 +00F4B +3009D +00F43 +3009D +00F50 +3009D +00F53 +3009D +00F4D +3009D +00F33 +3009D +00F3E +3009D +2A000 +00F49 +3009D +00F6E +3009D +00F76 +3009D +00F61 +3009D +00F6C +3009D +00F69 +3009D +00F64 +3009D +2A000 +00F54 +3009D +00F69 +3009D +00F6D +3009D +00F65 +3009D +2A000 +00F41 +3009D +00F6C +3009D +00F61 +3009D +00F72 +3009D +00F6D +3009D +2A000 +00F4F +3009D +00F46 +3009D +3009D +2A000 +00F4F +3009D +00F4E +3009D +2A000 +00F41 +3009D +00F63 +3009D +00F74 +3009D +00F69 +3009D +00F76 +3009D +00F65 +3009D +2A000 +00220 +070E0 +3017E +2F120 +18201 +2F020 +18201 +0003A +2F020 +18201 +18E01 +070E0 +3017E +2F120 +18201 +2F020 +18201 +0003A +2F020 +18201 +18E01 +070E0 +3017E +2F120 +18201 +2F020 +18201 +0000D +2F020 +2A000 +00130 +18101 +1C00A +35D7F +1C101 +1803A +2A000 +2E010 +2E111 +2E212 +2E313 +2E414 +2E515 +06200 +06301 +3C000 +2ED00 +2EC01 +3C001 +06400 +06501 +1D420 +1F530 +06202 +06303 +19240 +1B350 +00000 +1C2E8 +1E303 +3599F +18001 +3419A +182E8 +1A303 +2E202 +2E303 +06204 +06305 +19200 +1A300 +00000 +1C2E8 +1E303 +359AD +18001 +341AF +182E8 +1A303 +2E204 +2E305 +06108 +19100 +1413C +351B7 +2E108 +341C9 +00100 +2E108 +06107 +18101 +1413C +351BF +2E107 +341C9 +00100 +2E107 +06106 +18101 +14118 +351C7 +2E106 +341C9 +00100 +2E106 +06006 +06109 +15010 +355DB +06007 +0610A +15010 +355DB +06008 +0610B +15010 +355DB +0600C +12002 +351DB +0C001 +2E00C +300A4 +06010 +06111 +06212 +06313 +06414 +06515 +2A000 +14061 +2B800 +1407B +2BC00 +0A0DF +2A000 +180C6 +2B800 +1C0F6 +2A000 +07010 +301E8 +2B800 +01200 +20206 +20206 +19200 +20206 +18101 +07010 +301E8 +2B800 +19200 +2A000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +00000 +18D01 +1AC00 +38001 +343FC diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.V b/projects/PicoBlaze/ise/Assembler/UCLOCK.V new file mode 100644 index 0000000..ef65125 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.V @@ -0,0 +1,262 @@ +//////////////////////////////////////////////////////////////////////////////// +// Copyright (c) 2004 Xilinx, Inc. +// All Rights Reserved +//////////////////////////////////////////////////////////////////////////////// +// ____ ____ +// / /\/ / +// /___/ \ / Vendor: Xilinx +// \ \ \/ Version: v1.30 +// \ \ Application : KCPSM3 +// / / Filename: uclock.v +// /___/ /\ +// \ \ / \ +// \___\/\___\ +// +//Command: kcpsm3 uclock.psm +//Device: Spartan-3, Spartan-3E, Virtex-II, and Virtex-II Pro FPGAs +//Design Name: uclock +//Generated 25Sep2005-15:52:57. +//Purpose: +// uclock verilog program definition. +// +//Reference: +// PicoBlaze 8-bit Embedded Microcontroller User Guide +//////////////////////////////////////////////////////////////////////////////// +`timescale 1 ps / 1ps +module uclock (address, instruction, clk); +input [9:0] address; +input clk; +output [17:0] instruction; +RAMB16_S18 ram_1024_x_18( + .DI (16'h0000), + .DIP (2'b00), + .EN (1'b1), + .WE (1'b0), + .SSR (1'b0), + .CLK (clk), + .ADDR (address), + .DO (instruction[15:0]), + .DOP (instruction[17:16])) +/*synthesis +init_00 = "0D0000A4E00CE00BE00AE009E008E007E006E005E004E003E002E001E0000000" +init_01 = "40490091501200ED50374041501E40545012400D0091012000C30115C0010C00" +init_02 = "5812006D541C4020401200A8542C400D0091541C40450091541C404D0091541C" +init_03 = "541C40520091541C40410091541C404C0091401200A8E005E004E408E507E606" +init_04 = "5812006DC1015055404F0091541C4020401200AC5448400D0091541C404D0091" +init_05 = "401200ACE00CC002600C541C400D00915460404E0091401200ACE40BE50AE609" +init_06 = "1620588B01EC401200AC00A4E00C0000541C400D0091541C40460091541C4046" +init_07 = "009181011420588B01EC548B403A009181011520588B01EC548B403A00918101" +init_08 = "000E0001013400E70125A000000E00005C8B443C5C8B453C5C8B4618548B400D" +init_09 = "50A220024000A000009D4F0140950185549A20104000A000810101E27010A000" +init_0A = "013D00BC01600E09A00000BC01600E06A000C000A001600CA000CF01409D0185" +init_0B = "4F0D009D7F100120A0000148A000014E50BA2002A000015350B62001600C00E7" +init_0C = "810150D34F08B0004F0DFF10009554DB2008400082101210012040BD8101B000" +init_0D = "400000E400FAEF2000E440C3012240C600EA00E758D94120C10100EA54C65120" +init_0E = "0F79009D0F53A000009D0F08A000009D0F20A000009D0F0D40DF4F01B0002010" +init_0F = "009D0F65009D0F76009D0F4F410A009D0F78009D0F61009D0F74009D0F6E009D" +init_10 = "009D009D0F72009D0F4500E7009D0F77009D0F6F009D0F6C009D0F66009D0F72" +init_11 = "009D0F4D009D0F53009D0F50009D0F43009D0F4B00E4A000009D0F72009D0F6F" +init_12 = "0F69009D0F6C009D0F61009D0F76009D0F6E009D0F49A000009D0F3E009D0F33" +init_13 = "0F6C009D0F41A000009D0F65009D0F6D009D0F69009D0F54A000009D0F64009D" +init_14 = "009D0F4FA000009D009D0F46009D0F4FA000009D0F6D009D0F72009D0F61009D" +init_15 = "A000009D0F65009D0F76009D0F69009D0F74009D0F63009D0F41A000009D0F4E" +init_16 = "F0208201F120017E70E08E018201F020003A8201F0208201F120017E70E00220" +init_17 = "81010130A000F020000D8201F0208201F120017E70E08E018201F020003A8201" +init_18 = "EC01ED00C00063016200E515E414E313E212E111E010A000803AC1015D7FC00A" +init_19 = "82E8419A8001599FE303C2E80000B350924063036202F530D42065016400C001" +init_1A = "E204A30382E841AF800159ADE303C2E80000A300920063056204E303E202A303" +init_1B = "010041C9E10751BF413C81016107E108010041C9E10851B7413C91006108E305" +init_1C = "5010610A600755DB501061096006E106010041C9E10651C7411881016106E107" +init_1D = "6414631362126111601000A4E00CC00151DB2002600C55DB5010610B600855DB" +init_1E = "1200B80001E87010A000C0F6B80080C6A000A0DFBC00407BB8004061A0006515" +init_1F = "000000000000000000000000A0009200B80001E8701081010206920002060206" +init_20 = "0000000000000000000000000000000000000000000000000000000000000000" +init_21 = "0000000000000000000000000000000000000000000000000000000000000000" +init_22 = "0000000000000000000000000000000000000000000000000000000000000000" +init_23 = "0000000000000000000000000000000000000000000000000000000000000000" +init_24 = "0000000000000000000000000000000000000000000000000000000000000000" +init_25 = "0000000000000000000000000000000000000000000000000000000000000000" +init_26 = "0000000000000000000000000000000000000000000000000000000000000000" +init_27 = "0000000000000000000000000000000000000000000000000000000000000000" +init_28 = "0000000000000000000000000000000000000000000000000000000000000000" +init_29 = "0000000000000000000000000000000000000000000000000000000000000000" +init_2A = "0000000000000000000000000000000000000000000000000000000000000000" +init_2B = "0000000000000000000000000000000000000000000000000000000000000000" +init_2C = "0000000000000000000000000000000000000000000000000000000000000000" +init_2D = "0000000000000000000000000000000000000000000000000000000000000000" +init_2E = "0000000000000000000000000000000000000000000000000000000000000000" +init_2F = "0000000000000000000000000000000000000000000000000000000000000000" +init_30 = "0000000000000000000000000000000000000000000000000000000000000000" +init_31 = "0000000000000000000000000000000000000000000000000000000000000000" +init_32 = "0000000000000000000000000000000000000000000000000000000000000000" +init_33 = "0000000000000000000000000000000000000000000000000000000000000000" +init_34 = "0000000000000000000000000000000000000000000000000000000000000000" +init_35 = "0000000000000000000000000000000000000000000000000000000000000000" +init_36 = "0000000000000000000000000000000000000000000000000000000000000000" +init_37 = "0000000000000000000000000000000000000000000000000000000000000000" +init_38 = "0000000000000000000000000000000000000000000000000000000000000000" +init_39 = "0000000000000000000000000000000000000000000000000000000000000000" +init_3A = "0000000000000000000000000000000000000000000000000000000000000000" +init_3B = "0000000000000000000000000000000000000000000000000000000000000000" +init_3C = "0000000000000000000000000000000000000000000000000000000000000000" +init_3D = "0000000000000000000000000000000000000000000000000000000000000000" +init_3E = "0000000000000000000000000000000000000000000000000000000000000000" +init_3F = "43FC8001AC008D01000000000000000000000000000000000000000000000000" +initp_00 = "D3F74FDD3FF8DF7DF837DFEAF77DFDF7DF7DFEAAFDFDF7DF7FDDDCFC3AAAAAA8" +initp_01 = "CCCF333332CB2CC93EFFFD7D766F443670BBDBD3FCBCA0AFD2CFD2728FE8DDDD" +initp_02 = "4A19B1619B1619B0B333332CCBCCB33332CCCCB3333332CCCCCCCECCF33CCCCC" +initp_03 = "0009B19A2C9989980038D34343423B523B523B529775142977514143AC2AAA5D" +initp_04 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_05 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_06 = "0000000000000000000000000000000000000000000000000000000000000000" +initp_07 = "F500000000000000000000000000000000000000000000000000000000000000" */; +// synthesis translate_off +// Attributes for Simulation +defparam ram_1024_x_18.INIT_00 = 256'h0D0000A4E00CE00BE00AE009E008E007E006E005E004E003E002E001E0000000; +defparam ram_1024_x_18.INIT_01 = 256'h40490091501200ED50374041501E40545012400D0091012000C30115C0010C00; +defparam ram_1024_x_18.INIT_02 = 256'h5812006D541C4020401200A8542C400D0091541C40450091541C404D0091541C; +defparam ram_1024_x_18.INIT_03 = 256'h541C40520091541C40410091541C404C0091401200A8E005E004E408E507E606; +defparam ram_1024_x_18.INIT_04 = 256'h5812006DC1015055404F0091541C4020401200AC5448400D0091541C404D0091; +defparam ram_1024_x_18.INIT_05 = 256'h401200ACE00CC002600C541C400D00915460404E0091401200ACE40BE50AE609; +defparam ram_1024_x_18.INIT_06 = 256'h1620588B01EC401200AC00A4E00C0000541C400D0091541C40460091541C4046; +defparam ram_1024_x_18.INIT_07 = 256'h009181011420588B01EC548B403A009181011520588B01EC548B403A00918101; +defparam ram_1024_x_18.INIT_08 = 256'h000E0001013400E70125A000000E00005C8B443C5C8B453C5C8B4618548B400D; +defparam ram_1024_x_18.INIT_09 = 256'h50A220024000A000009D4F0140950185549A20104000A000810101E27010A000; +defparam ram_1024_x_18.INIT_0A = 256'h013D00BC01600E09A00000BC01600E06A000C000A001600CA000CF01409D0185; +defparam ram_1024_x_18.INIT_0B = 256'h4F0D009D7F100120A0000148A000014E50BA2002A000015350B62001600C00E7; +defparam ram_1024_x_18.INIT_0C = 256'h810150D34F08B0004F0DFF10009554DB2008400082101210012040BD8101B000; +defparam ram_1024_x_18.INIT_0D = 256'h400000E400FAEF2000E440C3012240C600EA00E758D94120C10100EA54C65120; +defparam ram_1024_x_18.INIT_0E = 256'h0F79009D0F53A000009D0F08A000009D0F20A000009D0F0D40DF4F01B0002010; +defparam ram_1024_x_18.INIT_0F = 256'h009D0F65009D0F76009D0F4F410A009D0F78009D0F61009D0F74009D0F6E009D; +defparam ram_1024_x_18.INIT_10 = 256'h009D009D0F72009D0F4500E7009D0F77009D0F6F009D0F6C009D0F66009D0F72; +defparam ram_1024_x_18.INIT_11 = 256'h009D0F4D009D0F53009D0F50009D0F43009D0F4B00E4A000009D0F72009D0F6F; +defparam ram_1024_x_18.INIT_12 = 256'h0F69009D0F6C009D0F61009D0F76009D0F6E009D0F49A000009D0F3E009D0F33; +defparam ram_1024_x_18.INIT_13 = 256'h0F6C009D0F41A000009D0F65009D0F6D009D0F69009D0F54A000009D0F64009D; +defparam ram_1024_x_18.INIT_14 = 256'h009D0F4FA000009D009D0F46009D0F4FA000009D0F6D009D0F72009D0F61009D; +defparam ram_1024_x_18.INIT_15 = 256'hA000009D0F65009D0F76009D0F69009D0F74009D0F63009D0F41A000009D0F4E; +defparam ram_1024_x_18.INIT_16 = 256'hF0208201F120017E70E08E018201F020003A8201F0208201F120017E70E00220; +defparam ram_1024_x_18.INIT_17 = 256'h81010130A000F020000D8201F0208201F120017E70E08E018201F020003A8201; +defparam ram_1024_x_18.INIT_18 = 256'hEC01ED00C00063016200E515E414E313E212E111E010A000803AC1015D7FC00A; +defparam ram_1024_x_18.INIT_19 = 256'h82E8419A8001599FE303C2E80000B350924063036202F530D42065016400C001; +defparam ram_1024_x_18.INIT_1A = 256'hE204A30382E841AF800159ADE303C2E80000A300920063056204E303E202A303; +defparam ram_1024_x_18.INIT_1B = 256'h010041C9E10751BF413C81016107E108010041C9E10851B7413C91006108E305; +defparam ram_1024_x_18.INIT_1C = 256'h5010610A600755DB501061096006E106010041C9E10651C7411881016106E107; +defparam ram_1024_x_18.INIT_1D = 256'h6414631362126111601000A4E00CC00151DB2002600C55DB5010610B600855DB; +defparam ram_1024_x_18.INIT_1E = 256'h1200B80001E87010A000C0F6B80080C6A000A0DFBC00407BB8004061A0006515; +defparam ram_1024_x_18.INIT_1F = 256'h000000000000000000000000A0009200B80001E8701081010206920002060206; +defparam ram_1024_x_18.INIT_20 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_21 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_22 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_23 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_24 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_25 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_26 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_27 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_28 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_29 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2A = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2B = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2C = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2D = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2E = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_2F = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_30 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_31 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_32 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_33 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_34 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_35 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_36 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_37 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_38 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_39 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3A = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3B = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3C = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3D = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3E = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INIT_3F = 256'h43FC8001AC008D01000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_00 = 256'hD3F74FDD3FF8DF7DF837DFEAF77DFDF7DF7DFEAAFDFDF7DF7FDDDCFC3AAAAAA8; +defparam ram_1024_x_18.INITP_01 = 256'hCCCF333332CB2CC93EFFFD7D766F443670BBDBD3FCBCA0AFD2CFD2728FE8DDDD; +defparam ram_1024_x_18.INITP_02 = 256'h4A19B1619B1619B0B333332CCBCCB33332CCCCB3333332CCCCCCCECCF33CCCCC; +defparam ram_1024_x_18.INITP_03 = 256'h0009B19A2C9989980038D34343423B523B523B529775142977514143AC2AAA5D; +defparam ram_1024_x_18.INITP_04 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_05 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_06 = 256'h0000000000000000000000000000000000000000000000000000000000000000; +defparam ram_1024_x_18.INITP_07 = 256'hF500000000000000000000000000000000000000000000000000000000000000; +// synthesis translate_on +// Attributes for XST (Synplicity attributes are in-line) +// synthesis attribute INIT_00 of ram_1024_x_18 is "0D0000A4E00CE00BE00AE009E008E007E006E005E004E003E002E001E0000000" +// synthesis attribute INIT_01 of ram_1024_x_18 is "40490091501200ED50374041501E40545012400D0091012000C30115C0010C00" +// synthesis attribute INIT_02 of ram_1024_x_18 is "5812006D541C4020401200A8542C400D0091541C40450091541C404D0091541C" +// synthesis attribute INIT_03 of ram_1024_x_18 is "541C40520091541C40410091541C404C0091401200A8E005E004E408E507E606" +// synthesis attribute INIT_04 of ram_1024_x_18 is "5812006DC1015055404F0091541C4020401200AC5448400D0091541C404D0091" +// synthesis attribute INIT_05 of ram_1024_x_18 is "401200ACE00CC002600C541C400D00915460404E0091401200ACE40BE50AE609" +// synthesis attribute INIT_06 of ram_1024_x_18 is "1620588B01EC401200AC00A4E00C0000541C400D0091541C40460091541C4046" +// synthesis attribute INIT_07 of ram_1024_x_18 is "009181011420588B01EC548B403A009181011520588B01EC548B403A00918101" +// synthesis attribute INIT_08 of ram_1024_x_18 is "000E0001013400E70125A000000E00005C8B443C5C8B453C5C8B4618548B400D" +// synthesis attribute INIT_09 of ram_1024_x_18 is "50A220024000A000009D4F0140950185549A20104000A000810101E27010A000" +// synthesis attribute INIT_0A of ram_1024_x_18 is "013D00BC01600E09A00000BC01600E06A000C000A001600CA000CF01409D0185" +// synthesis attribute INIT_0B of ram_1024_x_18 is "4F0D009D7F100120A0000148A000014E50BA2002A000015350B62001600C00E7" +// synthesis attribute INIT_0C of ram_1024_x_18 is "810150D34F08B0004F0DFF10009554DB2008400082101210012040BD8101B000" +// synthesis attribute INIT_0D of ram_1024_x_18 is "400000E400FAEF2000E440C3012240C600EA00E758D94120C10100EA54C65120" +// synthesis attribute INIT_0E of ram_1024_x_18 is "0F79009D0F53A000009D0F08A000009D0F20A000009D0F0D40DF4F01B0002010" +// synthesis attribute INIT_0F of ram_1024_x_18 is "009D0F65009D0F76009D0F4F410A009D0F78009D0F61009D0F74009D0F6E009D" +// synthesis attribute INIT_10 of ram_1024_x_18 is "009D009D0F72009D0F4500E7009D0F77009D0F6F009D0F6C009D0F66009D0F72" +// synthesis attribute INIT_11 of ram_1024_x_18 is "009D0F4D009D0F53009D0F50009D0F43009D0F4B00E4A000009D0F72009D0F6F" +// synthesis attribute INIT_12 of ram_1024_x_18 is "0F69009D0F6C009D0F61009D0F76009D0F6E009D0F49A000009D0F3E009D0F33" +// synthesis attribute INIT_13 of ram_1024_x_18 is "0F6C009D0F41A000009D0F65009D0F6D009D0F69009D0F54A000009D0F64009D" +// synthesis attribute INIT_14 of ram_1024_x_18 is "009D0F4FA000009D009D0F46009D0F4FA000009D0F6D009D0F72009D0F61009D" +// synthesis attribute INIT_15 of ram_1024_x_18 is "A000009D0F65009D0F76009D0F69009D0F74009D0F63009D0F41A000009D0F4E" +// synthesis attribute INIT_16 of ram_1024_x_18 is "F0208201F120017E70E08E018201F020003A8201F0208201F120017E70E00220" +// synthesis attribute INIT_17 of ram_1024_x_18 is "81010130A000F020000D8201F0208201F120017E70E08E018201F020003A8201" +// synthesis attribute INIT_18 of ram_1024_x_18 is "EC01ED00C00063016200E515E414E313E212E111E010A000803AC1015D7FC00A" +// synthesis attribute INIT_19 of ram_1024_x_18 is "82E8419A8001599FE303C2E80000B350924063036202F530D42065016400C001" +// synthesis attribute INIT_1A of ram_1024_x_18 is "E204A30382E841AF800159ADE303C2E80000A300920063056204E303E202A303" +// synthesis attribute INIT_1B of ram_1024_x_18 is "010041C9E10751BF413C81016107E108010041C9E10851B7413C91006108E305" +// synthesis attribute INIT_1C of ram_1024_x_18 is "5010610A600755DB501061096006E106010041C9E10651C7411881016106E107" +// synthesis attribute INIT_1D of ram_1024_x_18 is "6414631362126111601000A4E00CC00151DB2002600C55DB5010610B600855DB" +// synthesis attribute INIT_1E of ram_1024_x_18 is "1200B80001E87010A000C0F6B80080C6A000A0DFBC00407BB8004061A0006515" +// synthesis attribute INIT_1F of ram_1024_x_18 is "000000000000000000000000A0009200B80001E8701081010206920002060206" +// synthesis attribute INIT_20 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_21 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_22 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_23 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_24 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_25 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_26 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_27 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_28 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_29 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2A of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2B of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2C of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2D of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2E of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_2F of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_30 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_31 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_32 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_33 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_34 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_35 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_36 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_37 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_38 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_39 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3A of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3B of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3C of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3D of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3E of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INIT_3F of ram_1024_x_18 is "43FC8001AC008D01000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_00 of ram_1024_x_18 is "D3F74FDD3FF8DF7DF837DFEAF77DFDF7DF7DFEAAFDFDF7DF7FDDDCFC3AAAAAA8" +// synthesis attribute INITP_01 of ram_1024_x_18 is "CCCF333332CB2CC93EFFFD7D766F443670BBDBD3FCBCA0AFD2CFD2728FE8DDDD" +// synthesis attribute INITP_02 of ram_1024_x_18 is "4A19B1619B1619B0B333332CCBCCB33332CCCCB3333332CCCCCCCECCF33CCCCC" +// synthesis attribute INITP_03 of ram_1024_x_18 is "0009B19A2C9989980038D34343423B523B523B529775142977514143AC2AAA5D" +// synthesis attribute INITP_04 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_05 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_06 of ram_1024_x_18 is "0000000000000000000000000000000000000000000000000000000000000000" +// synthesis attribute INITP_07 of ram_1024_x_18 is "F500000000000000000000000000000000000000000000000000000000000000" +endmodule +// END OF FILE uclock.v diff --git a/projects/PicoBlaze/ise/Assembler/UCLOCK.VHD b/projects/PicoBlaze/ise/Assembler/UCLOCK.VHD new file mode 100644 index 0000000..cf61da9 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/UCLOCK.VHD @@ -0,0 +1,274 @@ +-- +-- Definition of a single port ROM for KCPSM3 program defined by uclock.psm +-- +-- Generated by KCPSM3 Assembler 25Sep2005-15:52:57. +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library unisim; +use unisim.vcomponents.all; +-- +-- +entity uclock is + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end uclock; +-- +architecture low_level_definition of uclock is +-- +-- Attributes to define ROM contents during implementation synthesis. +-- The information is repeated in the generic map for functional simulation +-- +attribute INIT_00 : string; +attribute INIT_01 : string; +attribute INIT_02 : string; +attribute INIT_03 : string; +attribute INIT_04 : string; +attribute INIT_05 : string; +attribute INIT_06 : string; +attribute INIT_07 : string; +attribute INIT_08 : string; +attribute INIT_09 : string; +attribute INIT_0A : string; +attribute INIT_0B : string; +attribute INIT_0C : string; +attribute INIT_0D : string; +attribute INIT_0E : string; +attribute INIT_0F : string; +attribute INIT_10 : string; +attribute INIT_11 : string; +attribute INIT_12 : string; +attribute INIT_13 : string; +attribute INIT_14 : string; +attribute INIT_15 : string; +attribute INIT_16 : string; +attribute INIT_17 : string; +attribute INIT_18 : string; +attribute INIT_19 : string; +attribute INIT_1A : string; +attribute INIT_1B : string; +attribute INIT_1C : string; +attribute INIT_1D : string; +attribute INIT_1E : string; +attribute INIT_1F : string; +attribute INIT_20 : string; +attribute INIT_21 : string; +attribute INIT_22 : string; +attribute INIT_23 : string; +attribute INIT_24 : string; +attribute INIT_25 : string; +attribute INIT_26 : string; +attribute INIT_27 : string; +attribute INIT_28 : string; +attribute INIT_29 : string; +attribute INIT_2A : string; +attribute INIT_2B : string; +attribute INIT_2C : string; +attribute INIT_2D : string; +attribute INIT_2E : string; +attribute INIT_2F : string; +attribute INIT_30 : string; +attribute INIT_31 : string; +attribute INIT_32 : string; +attribute INIT_33 : string; +attribute INIT_34 : string; +attribute INIT_35 : string; +attribute INIT_36 : string; +attribute INIT_37 : string; +attribute INIT_38 : string; +attribute INIT_39 : string; +attribute INIT_3A : string; +attribute INIT_3B : string; +attribute INIT_3C : string; +attribute INIT_3D : string; +attribute INIT_3E : string; +attribute INIT_3F : string; +attribute INITP_00 : string; +attribute INITP_01 : string; +attribute INITP_02 : string; +attribute INITP_03 : string; +attribute INITP_04 : string; +attribute INITP_05 : string; +attribute INITP_06 : string; +attribute INITP_07 : string; +-- +-- Attributes to define ROM contents during implementation synthesis. +-- +attribute INIT_00 of ram_1024_x_18 : label is "0D0000A4E00CE00BE00AE009E008E007E006E005E004E003E002E001E0000000"; +attribute INIT_01 of ram_1024_x_18 : label is "40490091501200ED50374041501E40545012400D0091012000C30115C0010C00"; +attribute INIT_02 of ram_1024_x_18 : label is "5812006D541C4020401200A8542C400D0091541C40450091541C404D0091541C"; +attribute INIT_03 of ram_1024_x_18 : label is "541C40520091541C40410091541C404C0091401200A8E005E004E408E507E606"; +attribute INIT_04 of ram_1024_x_18 : label is "5812006DC1015055404F0091541C4020401200AC5448400D0091541C404D0091"; +attribute INIT_05 of ram_1024_x_18 : label is "401200ACE00CC002600C541C400D00915460404E0091401200ACE40BE50AE609"; +attribute INIT_06 of ram_1024_x_18 : label is "1620588B01EC401200AC00A4E00C0000541C400D0091541C40460091541C4046"; +attribute INIT_07 of ram_1024_x_18 : label is "009181011420588B01EC548B403A009181011520588B01EC548B403A00918101"; +attribute INIT_08 of ram_1024_x_18 : label is "000E0001013400E70125A000000E00005C8B443C5C8B453C5C8B4618548B400D"; +attribute INIT_09 of ram_1024_x_18 : label is "50A220024000A000009D4F0140950185549A20104000A000810101E27010A000"; +attribute INIT_0A of ram_1024_x_18 : label is "013D00BC01600E09A00000BC01600E06A000C000A001600CA000CF01409D0185"; +attribute INIT_0B of ram_1024_x_18 : label is "4F0D009D7F100120A0000148A000014E50BA2002A000015350B62001600C00E7"; +attribute INIT_0C of ram_1024_x_18 : label is "810150D34F08B0004F0DFF10009554DB2008400082101210012040BD8101B000"; +attribute INIT_0D of ram_1024_x_18 : label is "400000E400FAEF2000E440C3012240C600EA00E758D94120C10100EA54C65120"; +attribute INIT_0E of ram_1024_x_18 : label is "0F79009D0F53A000009D0F08A000009D0F20A000009D0F0D40DF4F01B0002010"; +attribute INIT_0F of ram_1024_x_18 : label is "009D0F65009D0F76009D0F4F410A009D0F78009D0F61009D0F74009D0F6E009D"; +attribute INIT_10 of ram_1024_x_18 : label is "009D009D0F72009D0F4500E7009D0F77009D0F6F009D0F6C009D0F66009D0F72"; +attribute INIT_11 of ram_1024_x_18 : label is "009D0F4D009D0F53009D0F50009D0F43009D0F4B00E4A000009D0F72009D0F6F"; +attribute INIT_12 of ram_1024_x_18 : label is "0F69009D0F6C009D0F61009D0F76009D0F6E009D0F49A000009D0F3E009D0F33"; +attribute INIT_13 of ram_1024_x_18 : label is "0F6C009D0F41A000009D0F65009D0F6D009D0F69009D0F54A000009D0F64009D"; +attribute INIT_14 of ram_1024_x_18 : label is "009D0F4FA000009D009D0F46009D0F4FA000009D0F6D009D0F72009D0F61009D"; +attribute INIT_15 of ram_1024_x_18 : label is "A000009D0F65009D0F76009D0F69009D0F74009D0F63009D0F41A000009D0F4E"; +attribute INIT_16 of ram_1024_x_18 : label is "F0208201F120017E70E08E018201F020003A8201F0208201F120017E70E00220"; +attribute INIT_17 of ram_1024_x_18 : label is "81010130A000F020000D8201F0208201F120017E70E08E018201F020003A8201"; +attribute INIT_18 of ram_1024_x_18 : label is "EC01ED00C00063016200E515E414E313E212E111E010A000803AC1015D7FC00A"; +attribute INIT_19 of ram_1024_x_18 : label is "82E8419A8001599FE303C2E80000B350924063036202F530D42065016400C001"; +attribute INIT_1A of ram_1024_x_18 : label is "E204A30382E841AF800159ADE303C2E80000A300920063056204E303E202A303"; +attribute INIT_1B of ram_1024_x_18 : label is "010041C9E10751BF413C81016107E108010041C9E10851B7413C91006108E305"; +attribute INIT_1C of ram_1024_x_18 : label is "5010610A600755DB501061096006E106010041C9E10651C7411881016106E107"; +attribute INIT_1D of ram_1024_x_18 : label is "6414631362126111601000A4E00CC00151DB2002600C55DB5010610B600855DB"; +attribute INIT_1E of ram_1024_x_18 : label is "1200B80001E87010A000C0F6B80080C6A000A0DFBC00407BB8004061A0006515"; +attribute INIT_1F of ram_1024_x_18 : label is "000000000000000000000000A0009200B80001E8701081010206920002060206"; +attribute INIT_20 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_21 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_22 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_23 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_24 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_25 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_26 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_27 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_28 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_29 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2A of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2B of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2C of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2D of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2E of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_2F of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_30 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_31 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_32 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_33 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_34 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_35 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_36 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_37 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_38 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_39 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3A of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3B of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3C of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3D of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3E of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INIT_3F of ram_1024_x_18 : label is "43FC8001AC008D01000000000000000000000000000000000000000000000000"; +attribute INITP_00 of ram_1024_x_18 : label is "D3F74FDD3FF8DF7DF837DFEAF77DFDF7DF7DFEAAFDFDF7DF7FDDDCFC3AAAAAA8"; +attribute INITP_01 of ram_1024_x_18 : label is "CCCF333332CB2CC93EFFFD7D766F443670BBDBD3FCBCA0AFD2CFD2728FE8DDDD"; +attribute INITP_02 of ram_1024_x_18 : label is "4A19B1619B1619B0B333332CCBCCB33332CCCCB3333332CCCCCCCECCF33CCCCC"; +attribute INITP_03 of ram_1024_x_18 : label is "0009B19A2C9989980038D34343423B523B523B529775142977514143AC2AAA5D"; +attribute INITP_04 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_05 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_06 of ram_1024_x_18 : label is "0000000000000000000000000000000000000000000000000000000000000000"; +attribute INITP_07 of ram_1024_x_18 : label is "F500000000000000000000000000000000000000000000000000000000000000"; +-- +begin +-- + --Instantiate the Xilinx primitive for a block RAM + ram_1024_x_18: RAMB16_S18 + --synthesis translate_off + --INIT values repeated to define contents for functional simulation + generic map ( INIT_00 => X"0D0000A4E00CE00BE00AE009E008E007E006E005E004E003E002E001E0000000", + INIT_01 => X"40490091501200ED50374041501E40545012400D0091012000C30115C0010C00", + INIT_02 => X"5812006D541C4020401200A8542C400D0091541C40450091541C404D0091541C", + INIT_03 => X"541C40520091541C40410091541C404C0091401200A8E005E004E408E507E606", + INIT_04 => X"5812006DC1015055404F0091541C4020401200AC5448400D0091541C404D0091", + INIT_05 => X"401200ACE00CC002600C541C400D00915460404E0091401200ACE40BE50AE609", + INIT_06 => X"1620588B01EC401200AC00A4E00C0000541C400D0091541C40460091541C4046", + INIT_07 => X"009181011420588B01EC548B403A009181011520588B01EC548B403A00918101", + INIT_08 => X"000E0001013400E70125A000000E00005C8B443C5C8B453C5C8B4618548B400D", + INIT_09 => X"50A220024000A000009D4F0140950185549A20104000A000810101E27010A000", + INIT_0A => X"013D00BC01600E09A00000BC01600E06A000C000A001600CA000CF01409D0185", + INIT_0B => X"4F0D009D7F100120A0000148A000014E50BA2002A000015350B62001600C00E7", + INIT_0C => X"810150D34F08B0004F0DFF10009554DB2008400082101210012040BD8101B000", + INIT_0D => X"400000E400FAEF2000E440C3012240C600EA00E758D94120C10100EA54C65120", + INIT_0E => X"0F79009D0F53A000009D0F08A000009D0F20A000009D0F0D40DF4F01B0002010", + INIT_0F => X"009D0F65009D0F76009D0F4F410A009D0F78009D0F61009D0F74009D0F6E009D", + INIT_10 => X"009D009D0F72009D0F4500E7009D0F77009D0F6F009D0F6C009D0F66009D0F72", + INIT_11 => X"009D0F4D009D0F53009D0F50009D0F43009D0F4B00E4A000009D0F72009D0F6F", + INIT_12 => X"0F69009D0F6C009D0F61009D0F76009D0F6E009D0F49A000009D0F3E009D0F33", + INIT_13 => X"0F6C009D0F41A000009D0F65009D0F6D009D0F69009D0F54A000009D0F64009D", + INIT_14 => X"009D0F4FA000009D009D0F46009D0F4FA000009D0F6D009D0F72009D0F61009D", + INIT_15 => X"A000009D0F65009D0F76009D0F69009D0F74009D0F63009D0F41A000009D0F4E", + INIT_16 => X"F0208201F120017E70E08E018201F020003A8201F0208201F120017E70E00220", + INIT_17 => X"81010130A000F020000D8201F0208201F120017E70E08E018201F020003A8201", + INIT_18 => X"EC01ED00C00063016200E515E414E313E212E111E010A000803AC1015D7FC00A", + INIT_19 => X"82E8419A8001599FE303C2E80000B350924063036202F530D42065016400C001", + INIT_1A => X"E204A30382E841AF800159ADE303C2E80000A300920063056204E303E202A303", + INIT_1B => X"010041C9E10751BF413C81016107E108010041C9E10851B7413C91006108E305", + INIT_1C => X"5010610A600755DB501061096006E106010041C9E10651C7411881016106E107", + INIT_1D => X"6414631362126111601000A4E00CC00151DB2002600C55DB5010610B600855DB", + INIT_1E => X"1200B80001E87010A000C0F6B80080C6A000A0DFBC00407BB8004061A0006515", + INIT_1F => X"000000000000000000000000A0009200B80001E8701081010206920002060206", + INIT_20 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_21 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_22 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_23 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_24 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_25 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_26 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_27 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_28 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_29 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2A => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2B => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2C => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2D => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2E => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_2F => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_30 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_31 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_32 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_33 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_34 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_35 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_36 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_37 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_38 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_39 => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3A => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3B => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3C => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3D => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3E => X"0000000000000000000000000000000000000000000000000000000000000000", + INIT_3F => X"43FC8001AC008D01000000000000000000000000000000000000000000000000", + INITP_00 => X"D3F74FDD3FF8DF7DF837DFEAF77DFDF7DF7DFEAAFDFDF7DF7FDDDCFC3AAAAAA8", + INITP_01 => X"CCCF333332CB2CC93EFFFD7D766F443670BBDBD3FCBCA0AFD2CFD2728FE8DDDD", + INITP_02 => X"4A19B1619B1619B0B333332CCBCCB33332CCCCB3333332CCCCCCCECCF33CCCCC", + INITP_03 => X"0009B19A2C9989980038D34343423B523B523B529775142977514143AC2AAA5D", + INITP_04 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_05 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_06 => X"0000000000000000000000000000000000000000000000000000000000000000", + INITP_07 => X"F500000000000000000000000000000000000000000000000000000000000000") + --synthesis translate_on + port map( DI => "0000000000000000", + DIP => "00", + EN => '1', + WE => '0', + SSR => '0', + CLK => clk, + ADDR => address, + DO => instruction(15 downto 0), + DOP => instruction(17 downto 16)); +-- +end low_level_definition; +-- +------------------------------------------------------------------------------------ +-- +-- END OF FILE uclock.vhd +-- +------------------------------------------------------------------------------------ diff --git a/projects/PicoBlaze/ise/Assembler/cleanup.bat b/projects/PicoBlaze/ise/Assembler/cleanup.bat new file mode 100644 index 0000000..207ea83 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/cleanup.bat @@ -0,0 +1,3 @@ +copy %1.psm previous_%1.psm +del %1.psm +copy %1.fmt %1.psm diff --git a/projects/PicoBlaze/ise/Assembler/int_test.psm b/projects/PicoBlaze/ise/Assembler/int_test.psm new file mode 100644 index 0000000..2acecbd --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/int_test.psm @@ -0,0 +1,25 @@ + ;Interrupt example + ; + CONSTANT waveform_port, 02 ;bit0 will be data + CONSTANT counter_port, 04 + CONSTANT pattern_10101010, AA + NAMEREG sA, interrupt_counter + ; + start: LOAD interrupt_counter, 00 ;reset interrupt counter + LOAD s2, pattern_10101010 ;initial output condition + ENABLE INTERRUPT + ; + drive_wave: OUTPUT s2, waveform_port + LOAD s0, 07 ;delay size + loop: SUB s0, 01 ;delay loop + JUMP NZ, loop + XOR s2, FF ;toggle waveform + JUMP drive_wave + ; + ADDRESS 2B0 +int_routine: ADD interrupt_counter, 01 ;increment counter + OUTPUT interrupt_counter, counter_port + RETURNI ENABLE + ; + ADDRESS 3FF ;set interrupt vector + JUMP int_routine diff --git a/projects/PicoBlaze/ise/Assembler/uclock.psm b/projects/PicoBlaze/ise/Assembler/uclock.psm new file mode 100644 index 0000000..543cd20 --- /dev/null +++ b/projects/PicoBlaze/ise/Assembler/uclock.psm @@ -0,0 +1,1008 @@ + ;KCPSM3 Program - Real Time Clock with UART communication. + ; + ;Ken Chapman - Xilinx Ltd - October 2003 + ; + ; + ;Port definitions + ; + CONSTANT UART_status_port, 00 ;UART status input + CONSTANT tx_half_full, 01 ; Transmitter half full - bit0 + CONSTANT tx_full, 02 ; FIFO full - bit1 + CONSTANT rx_half_full, 04 ; Receiver half full - bit2 + CONSTANT rx_full, 08 ; FIFO full - bit3 + CONSTANT rx_data_present, 10 ; data present - bit4 + ; + CONSTANT UART_read_port, 01 ;UART Rx data input + ; + CONSTANT UART_write_port, 01 ;UART Tx data output + ; + CONSTANT alarm_port, 00 ;Alarm output + CONSTANT alarm_control, 01 ; bit0 + ; + ;Special Register usage + ; + NAMEREG sF, UART_data ;used to pass data to and from the UART + ; + NAMEREG sE, store_pointer ;used to pass location of data in scratch pad memory + ; + ;Two registers to form a 16-bit counter used to count + ;interrupt pulses generated at 1us intervals. + ; + NAMEREG sD, int_counter_lsb ;lower 8-bits + NAMEREG sC, int_counter_msb ;upper 8-bits + ; + ; + ;Scratch Pad Memory Locations + ; + ; + CONSTANT us_time_stamp_lsb, 00 ;16-bit micro-second time stamp + CONSTANT us_time_stamp_msb, 01 + ; + CONSTANT us_time_lsb, 02 ;16-bit micro-second real time value + CONSTANT us_time_msb, 03 + ; + CONSTANT ms_time_lsb, 04 ;16-bit milli-second real time value + CONSTANT ms_time_msb, 05 + ; + CONSTANT real_time_hours, 06 ;Current clock time + CONSTANT real_time_minutes, 07 + CONSTANT real_time_seconds, 08 + ; + CONSTANT alarm_time_hours, 09 ;Alarm time + CONSTANT alarm_time_minutes, 0A + CONSTANT alarm_time_seconds, 0B + ; + CONSTANT alarm_status, 0C ;Alarm status + CONSTANT alarm_active, 01 ; bit0 - Alarm is active + CONSTANT alarm_armed, 02 ; bit1 - Alarm is armed + ; + CONSTANT time_preserve0, 10 ;storage for protection of registers + CONSTANT time_preserve1, 11 ;used by the real time clock routine. + CONSTANT time_preserve2, 12 + CONSTANT time_preserve3, 13 + CONSTANT time_preserve4, 14 + CONSTANT time_preserve5, 15 + ; + ;UART character strings will be stored in scratch pad memory ending in carriage return. + ;A string can be up to 16 characters with the start location defined by this constant. + ; + CONSTANT string_start, 20 + ; + ; + ;Initialise the system + ; + ; + cold_start: LOAD s0, 00 ;clear all time values + STORE s0, us_time_stamp_lsb + STORE s0, us_time_stamp_msb + STORE s0, us_time_lsb + STORE s0, us_time_msb + STORE s0, ms_time_lsb + STORE s0, ms_time_msb + STORE s0, real_time_hours + STORE s0, real_time_minutes + STORE s0, real_time_seconds + STORE s0, alarm_time_hours + STORE s0, alarm_time_minutes + STORE s0, alarm_time_seconds + STORE s0, alarm_status ;clear and disable alarm + CALL alarm_drive ;turn off alarm control output port + LOAD int_counter_lsb, 00 ;clear 'us' interrupt counter + LOAD int_counter_msb, 00 + ENABLE INTERRUPT ;enable the 1us interrupts + ; + ; + ;Start of the main program loop. + ; + ;A prompt is transmitted to the UART transmitter and then + ;a command can be entered and interpreted. + ; + ; + prompt_input: CALL send_prompt ;Prompt 'KCPSM3>' + CALL receive_string ;obtain input string and maintain the time + ; + ; + ;Parse the string and perform actions as required + ; + ; + ; + LOAD s1, string_start + CALL fetch_char_from_memory + COMPARE s0, character_CR ;carriage return does nothing + JUMP Z, prompt_input + COMPARE s0, character_T ;start of 'TIME' command? + JUMP Z, test_for_TIME + COMPARE s0, character_A ;start of 'ALARM' command? + JUMP Z, test_for_ALARM + ; + ;trap other command starts here + ; + bad_input_command: CALL send_Syntax_Error ;no valid command + JUMP Z, prompt_input + ; + ; + test_for_TIME: CALL fetch_char_from_memory + COMPARE s0, character_I ;test for rest of 'TIME' + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_M + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_E + JUMP NZ, bad_input_command + ;now have a valid TIME command to process + CALL fetch_char_from_memory + COMPARE s0, character_CR ;carriage return means display time + JUMP NZ, set_time_command + CALL transmit_time ;transmit time to UART + JUMP prompt_input + set_time_command: COMPARE s0, character_space + JUMP NZ, bad_input_command + CALL test_time_string ;interpret 'hh:mm:ss' string + JUMP C, prompt_input ;test for invalid input + STORE s6, real_time_hours ;set new time into clock + STORE s5, real_time_minutes + STORE s4, real_time_seconds + STORE s0, ms_time_lsb ;clear 'ms' counter (s0=00) + STORE s0, ms_time_msb + CALL transmit_time ;transmit new time to UART + JUMP prompt_input + ; + ; + test_for_ALARM: CALL fetch_char_from_memory + COMPARE s0, character_L ;test for rest of 'ALARM' + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_A + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_R + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_M + JUMP NZ, bad_input_command + ;now have a valid ALARM command to process + CALL fetch_char_from_memory + COMPARE s0, character_CR ;carriage return means display alarm time + JUMP NZ, set_alarm_command + CALL transmit_alarm_time ;transmit time to UART + JUMP prompt_input + set_alarm_command: COMPARE s0, character_space ;test for ON or OFF command + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_O + JUMP Z, set_alarm_on_off + SUB s1, 01 ;move memory pointer back to first character of 'hh:mm:ss' string + CALL test_time_string ;interpret 'hh:mm:ss' string + JUMP C, prompt_input ;test for invalid input + STORE s6, alarm_time_hours ;set new time into clock + STORE s5, alarm_time_minutes + STORE s4, alarm_time_seconds + CALL transmit_alarm_time ;transmit new alarm time and status + JUMP prompt_input + set_alarm_on_off: CALL fetch_char_from_memory + COMPARE s0, character_N ;test for 'ON' + JUMP NZ, test_OFF + CALL fetch_char_from_memory + COMPARE s0, character_CR + JUMP NZ, bad_input_command + FETCH s0, alarm_status ;turn alarm on + OR s0, alarm_armed + STORE s0, alarm_status + CALL transmit_alarm_time ;transmit alarm time and status + JUMP prompt_input + test_OFF: COMPARE s0, character_F ;test for for 'OFF' + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_F + JUMP NZ, bad_input_command + CALL fetch_char_from_memory + COMPARE s0, character_CR + JUMP NZ, bad_input_command + LOAD s0, 00 ;turn alarm off and stop an active alarm + STORE s0, alarm_status + CALL alarm_drive ;turn off alarm + CALL transmit_alarm_time ;transmit alarm time and status + JUMP prompt_input + ; + ; + ; + ; + ;Read an 'hh:mm:ss' time string and provide new values. + ; + ;The string must be provided in successive scratch pad memory locations + ;with the s1 register containing the location of the first character. + ; + ;A correct time specification will result in the return of new values + ;as follows:- + ; + ; s6 = hours + ; s5 = minutes + ; s4 = seconds + ; + ;If the syntax is incorrect or values are not in the correct ranges an + ;'Invalid Time' message will be transmitted and the CARRY flag will be set + ; + ;Registers used s0, s1, s6, s5 and s4 + ; + test_time_string: CALL 2char_to_value ;obtain hours value + JUMP C, invalid_time ;test for non-decimal characters + LOAD s6, s2 ;remember hours + ADD s1, 01 ;increment memory pointer past hours + CALL fetch_char_from_memory + COMPARE s0, character_colon ;test for colon + JUMP NZ, invalid_time + CALL 2char_to_value ;obtain minutes value + JUMP C, invalid_time ;test for non-decimal characters + LOAD s5, s2 ;remember minutes + ADD s1, 01 ;increment memory pointer past minutes + CALL fetch_char_from_memory + COMPARE s0, character_colon ;test for colon + JUMP NZ, invalid_time + CALL 2char_to_value ;obtain seconds value + JUMP C, invalid_time ;test for non-decimal characters + LOAD s4, s2 ;remember minutes + ADD s1, 01 ;increment memory pointer past seconds + CALL fetch_char_from_memory + COMPARE s0, character_CR ;finish with carriage return + JUMP NZ, invalid_time + ;Have values for hh:mm:ss but need to test if each is valid range. + COMPARE s6, hours_in_a_day + JUMP NC, invalid_time + COMPARE s5, minutes_in_an_hour + JUMP NC, invalid_time + COMPARE s4, seconds_in_a_minute + JUMP NC, invalid_time + LOAD s0, 00 + SR0 s0 ;reset CARRY flag (with s0=0) + RETURN ;time string was OK + invalid_time: CALL send_Invalid + CALL send_space + CALL send_Time + LOAD s0, 01 + SR0 s0 ;set CARRY flag + RETURN ;time string was bad + ; + ; + ;Fetch character from memory, convert to upper case + ;and increment memory pointer. + ; + ;The memory pointer is provided in register s1. + ;The character obtained is returned in register s0. + ; + ;Registers used s0 and s1. + ; +fetch_char_from_memory: FETCH s0, (s1) ;read character + CALL upper_case ;convert to upper case + ADD s1, 01 ;increment memory pointer + RETURN + ; + ; + ; + ;Read one character from the UART + ; + ;Character read will be returned in a register called 'UART_data' and will be + ;echoed to the UART transmitter. + ; + ;The routine first tests the receiver FIFO buffer to see if data is present. + ;If the FIFO is empty, the routine waits until there is a character to read. + ;As this could take any amount of time the wait loop includes a call to the + ;subroutine which updates the real time clock. + ; + ;Registers used s0 and UART_data + ; + read_from_UART: INPUT s0, UART_status_port ;test Rx_FIFO buffer + TEST s0, rx_data_present + JUMP NZ, read_character + CALL update_time ;Perform useful operation whilst waiting + JUMP read_from_UART + read_character: INPUT UART_data, UART_read_port ;read from FIFO + CALL send_to_UART ;echo received character + RETURN + ; + ; + ; + ;Transmit one character to the UART + ; + ;Character supplied in register called 'UART_data'. + ; + ;The routine first tests the transmit FIFO buffer to see if it is full. + ;If the FIFO is full, the routine waits until there is space which could + ;be as long as it takes to transmit one complete character. + ; + ; Baud Rate Time per Character (10 bits) + ; 9600 1,024us + ; 19200 521us + ; 38400 260us + ; 57600 174us + ; 115200 87us + ; + ;Since this is a relatively long duration, the wait loop includes a + ;call to the subroutine which updates the real time clock. + ; + ;Registers used s0 + ; + send_to_UART: INPUT s0, UART_status_port ;test Tx_FIFO buffer + TEST s0, tx_full + JUMP Z, UART_write + CALL update_time ;Perform useful operation whilst waiting + JUMP send_to_UART + UART_write: OUTPUT UART_data, UART_write_port + RETURN + ; + ; + ; + ; + ;Alarm output + ; + ;Uses the alarm status scratch pad memory to set or reset the alarm + ;control bit on the alarm output port. + ; + ;Registers used s0 + ; + alarm_drive: FETCH s0, alarm_status ;read status + AND s0, alarm_active ;isolate bit0 + OUTPUT s0, alarm_port + RETURN + ; + ; + ; + ; + ; + ;Transmit the time to the UART port in the format hh:mm:ss and end + ;with a carriage return. + ; + ;The time to converted must be stored in 3 scratch pad memory locations as + ;defined below. A register named 'store_pointer' must provide the address of + ;first location. + ; + ; Address Data + ; + ; store_pointer ----> hours + ; store_pointer + 1 ----> minutes + ; store_pointer + 1 ----> seconds + ; + ;The routine first converts the time into an ASCII string stored in scratch + ;pad memory starting at a location specified by a constant named 'string_start'. + ;The string will then be transmitted. + ; + ;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ; + transmit_time: LOAD store_pointer, real_time_hours ;locate current time in memory + CALL time_to_ASCII + CALL transmit_string + RETURN + ; + ; + ;Transmit the alarm time and status to the UART port in the format hh:mm:ss and + ;ending with carriage return. + ; + ;The alarm time to converted must be stored in 3 scratch pad memory locations as + ;defined below. A register named 'store_pointer' must provide the address of + ;first location. + ; + ; Address Data + ; + ; store_pointer ----> hours + ; store_pointer + 1 ----> minutes + ; store_pointer + 1 ----> seconds + ; + ;The routine first converts the time into an ASCII string stored in scratch + ;pad memory starting at a location specified by a constant named 'string_start'. + ;The string will then be transmitted. + ; + ;Registers used s0, s1, s2, 'store_pointer' and 'UART_data'. + ; + transmit_alarm_time: LOAD store_pointer, alarm_time_hours ;locate alarm time in memory + CALL time_to_ASCII + CALL transmit_string + CALL send_Alarm + CALL send_space + FETCH s0, alarm_status ;read alarm status + TEST s0, alarm_active ;test for active + JUMP Z, test_armed + CALL send_Active + RETURN + test_armed: TEST s0, alarm_armed ;test for on + JUMP Z, alarm_is_off + CALL send_ON + RETURN + alarm_is_off: CALL send_OFF + RETURN + ; + ; + ;Transmit ASCII string to UART + ; + ;An ASCII string must be provided in scratch pad memory commencing at the + ;location specified by a constant named 'string_start'. The string must + ;end with a carriage return (0D). + ; + ;Registers used s1 and 'UART_data'. + ; s0 is then used in subroutine 'send_to_UART' + ; + transmit_string: LOAD s1, string_start ;locate start of string + next_char_tx: FETCH UART_data, (s1) ;read character from memory + CALL send_to_UART ;transmit character + COMPARE UART_data, character_CR ;test for last character + RETURN Z + ADD s1, 01 ;move to next character + JUMP next_char_tx + ; + ; + ;Receive ASCII string from UART + ; + ;An ASCII string will be read from the UART and stored in scratch pad memory + ;commencing at the location specified by a constant named 'string_start'. + ;The string will will have a maximum length of 16 characters including a + ;carriage return (0D) denoting the end of the string. + ; + ;As each character is read, it is echoed to the UART transmitter. + ;Some minor editing is supported using backspace (BS=08) which is used + ;to adjust what is stored in scratch pad memory and adjust the display + ;on the terminal screen using characters sent to the UART transmitter. + ; + ;A test is made for the receiver FIFO becoming full. A full status is treated as + ;a potential error situation and will result in a 'Overflow Error' message being + ;transmitted to the UART, the receiver FIFO being purged of all data and an + ;empty string being stored (carriage return at first location). + ; + ;Registers used s0, s1, s2 and 'UART_data'. + ; + receive_string: LOAD s1, string_start ;locate start of string + LOAD s2, s1 ;compute 16 character address + ADD s2, 10 + receive_full_test: INPUT s0, UART_status_port ;test Rx_FIFO buffer for full + TEST s0, rx_full + JUMP NZ, read_error + CALL read_from_UART ;obtain and echo character + STORE UART_data, (s1) ;write to memory + COMPARE UART_data, character_CR ;test for end of string + RETURN Z + COMPARE UART_data, character_BS ;test for back space + JUMP Z, BS_edit + ADD s1, 01 ;increment memory pointer + COMPARE s1, s2 ;test for pointer exceeding 16 characters + JUMP NZ, receive_full_test ;next character + CALL send_backspace ;hold end of string position on terminal display + BS_edit: SUB s1, 01 ;memory pointer back one + COMPARE s1, string_start ;test for under flow + JUMP C, string_start_again + CALL send_space ;clear character at current position + CALL send_backspace ;position cursor + JUMP receive_full_test ;next character + string_start_again: CALL send_greater_than ;restore '>' at prompt + JUMP receive_string ;begin again + ;Receiver buffer overflow condition + read_error: CALL send_CR ;Transmit error message + STORE UART_data, string_start ;empty string in memory (start with CR) + CALL send_Overflow_Error + CALL send_CR + clear_UART_Rx_loop: INPUT s0, UART_status_port ;test Rx_FIFO buffer for data + TEST s0, rx_data_present + RETURN Z ;finish when buffer is empty + INPUT UART_data, UART_read_port ;read from FIFO and ignore + JUMP clear_UART_Rx_loop + ; + ; + ; + ;Send Carriage Return to the UART + ; + send_CR: LOAD UART_data, character_CR + CALL send_to_UART + RETURN + ; + ; + ; + ;Send a space to the UART + ; + send_space: LOAD UART_data, character_space + CALL send_to_UART + RETURN + ; + ; + ;Send a back space to the UART + ; + send_backspace: LOAD UART_data, character_BS + CALL send_to_UART + RETURN + ; + ;Send 'Syntax Error' to the UART + ; + send_Syntax_Error: LOAD UART_data, character_S + CALL send_to_UART + LOAD UART_data, character_y + CALL send_to_UART + LOAD UART_data, character_n + CALL send_to_UART + LOAD UART_data, character_t + CALL send_to_UART + LOAD UART_data, character_a + CALL send_to_UART + LOAD UART_data, character_x + CALL send_to_UART + JUMP send_space_Error + ; + ;Send 'Overflow Error' to the UART + ; + send_Overflow_Error: LOAD UART_data, character_O + CALL send_to_UART + LOAD UART_data, character_v + CALL send_to_UART + LOAD UART_data, character_e + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + LOAD UART_data, character_f + CALL send_to_UART + LOAD UART_data, character_l + CALL send_to_UART + LOAD UART_data, character_o + CALL send_to_UART + LOAD UART_data, character_w + CALL send_to_UART + send_space_Error: CALL send_space + ; + ;Send 'Error' to the UART + ; + send_Error: LOAD UART_data, character_E + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + CALL send_to_UART + LOAD UART_data, character_o + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + RETURN + ; + ;Send 'KCPSM3>' prompt to the UART + ; + send_prompt: CALL send_CR ;start new line + LOAD UART_data, character_K + CALL send_to_UART + LOAD UART_data, character_C + CALL send_to_UART + LOAD UART_data, character_P + CALL send_to_UART + LOAD UART_data, character_S + CALL send_to_UART + LOAD UART_data, character_M + CALL send_to_UART + LOAD UART_data, character_3 + CALL send_to_UART + ; + ;Send '>' character to the UART + ; + send_greater_than: LOAD UART_data, character_greater_than + CALL send_to_UART + RETURN + ; + ;Send 'Invalid' string to the UART + ; + send_Invalid: LOAD UART_data, character_I + CALL send_to_UART + LOAD UART_data, character_n + CALL send_to_UART + LOAD UART_data, character_v + CALL send_to_UART + LOAD UART_data, character_a + CALL send_to_UART + LOAD UART_data, character_l + CALL send_to_UART + LOAD UART_data, character_i + CALL send_to_UART + LOAD UART_data, character_d + CALL send_to_UART + RETURN + ; + ;Send 'Time' string to the UART + ; + send_Time: LOAD UART_data, character_T + CALL send_to_UART + LOAD UART_data, character_i + CALL send_to_UART + LOAD UART_data, character_m + CALL send_to_UART + LOAD UART_data, character_e + CALL send_to_UART + RETURN + ; + ;Send 'Alarm' string to the UART + ; + send_Alarm: LOAD UART_data, character_A + CALL send_to_UART + LOAD UART_data, character_l + CALL send_to_UART + LOAD UART_data, character_a + CALL send_to_UART + LOAD UART_data, character_r + CALL send_to_UART + LOAD UART_data, character_m + CALL send_to_UART + RETURN + ; + ;Send 'OFF' string to the UART + ; + send_OFF: LOAD UART_data, character_O + CALL send_to_UART + LOAD UART_data, character_F + CALL send_to_UART + CALL send_to_UART + RETURN + ; + ;Send 'ON' string to the UART + ; + send_ON: LOAD UART_data, character_O + CALL send_to_UART + LOAD UART_data, character_N + CALL send_to_UART + RETURN + ; + ;Send 'Active' string to the UART + ; + send_Active: LOAD UART_data, character_A + CALL send_to_UART + LOAD UART_data, character_c + CALL send_to_UART + LOAD UART_data, character_t + CALL send_to_UART + LOAD UART_data, character_i + CALL send_to_UART + LOAD UART_data, character_v + CALL send_to_UART + LOAD UART_data, character_e + CALL send_to_UART + RETURN + ; + ; + ;Convert time to ASCII string in scratch pad memory. + ; + ;The time to converted must be stored in 3 scratch pad memory locations as + ;defined below. A register named 'store_pointer' must provide the address of + ;first location. + ; + ; Address Data + ; + ; store_pointer ----> hours + ; store_pointer + 1 ----> minutes + ; store_pointer + 1 ----> seconds + ; + ;The resulting ASCII string will be stored in scratch pad memory starting at + ;a location specified by a constant named 'string_start'. The string will + ;take the format hh:mm:ss and end with a carriage return. + ; + ;Registers used s0, s1, s2 and 'store_pointer'. + ; + time_to_ASCII: LOAD s2, string_start ;location for string + FETCH s0, (store_pointer) ;read hours value + CALL decimal_to_ASCII ;convert to ASCII + STORE s1, (s2) ;write hours to string + ADD s2, 01 + STORE s0, (s2) + ADD s2, 01 + LOAD s0, character_colon ;write ':' to string + STORE s0, (s2) + ADD s2, 01 + ADD store_pointer, 01 ;move to minutes + FETCH s0, (store_pointer) ;read minutes value + CALL decimal_to_ASCII ;convert to ASCII + STORE s1, (s2) ;write minutes to string + ADD s2, 01 + STORE s0, (s2) + ADD s2, 01 + LOAD s0, character_colon ;write ':' to string + STORE s0, (s2) + ADD s2, 01 + ADD store_pointer, 01 ;move to seconds + FETCH s0, (store_pointer) ;read seconds value + CALL decimal_to_ASCII ;convert to ASCII + STORE s1, (s2) ;write seconds to string + ADD s2, 01 + STORE s0, (s2) + ADD s2, 01 + LOAD s0, character_CR ;finish string with carriage return + STORE s0, (s2) + RETURN + ; + ;Convert value provided in register s0 into ASCII characters + ; + ;The value provided must in the range 0 to 99 and will be converted into + ;two ASCII characters. + ; The number of 'tens' will be representd by an ASCII character returned in register s1. + ; The number of 'units' will be representd by an ASCII character returned in register s0. + ; + ;The ASCII representations of '0' to '9' are 30 to 39 hexadecimal which is simply 30 hex added to + ;the actual decimal value. + ; + ;Registers used s0 and s1. + ; + decimal_to_ASCII: LOAD s1, 30 ;load 'tens' counter with ASCII for '0' + test_for_ten: ADD s1, 01 ;increment 'tens' value + SUB s0, 0A ;try to subtract 10 from the supplied value + JUMP NC, test_for_ten ;repeat if subtraction was possible without underflow. + SUB s1, 01 ;'tens' value one less ten due to underflow + ADD s0, 3A ;restore units value (the remainder) and convert to ASCII + RETURN + ; + ; + ; + ; + ;Real Time Clock + ; + ;Uses the 1us interrupt counter [int_counter_msb,int_counter_lsb] to determine how many + ;micro-seconds have elapsed since the last update. This allows for just over 65ms between + ;updates. Complete multiples of 1000us are used to update a 16-bit milli-second counter held + ;in scratch pad memory locations [ms_time_stamp_msb,ms_time_stamp_msb] which in turn + ;is used to update the real time hours, minutes and seconds clock held in scratch pad + ;memory locations 'real_time_hours', 'real_time_minutes' and 'real_time_seconds'. + ; + ;The routine uses default register names s0,s1,s2,s3,s4,s5. These are preserved in scratch pad + ;memory during the routine and restored before returning. + ; + ;Useful constants for real time clock operations + ; + CONSTANT count_1000_lsb, E8 ;lower 8-bits of 1000 count value + CONSTANT count_1000_msb, 03 ;upper 8-bits of 1000 count value + CONSTANT hours_in_a_day, 18 ;24 hours in a day + CONSTANT minutes_in_an_hour, 3C ;60 minutes in an hour + CONSTANT seconds_in_a_minute, 3C ;60 seconds in a minute + ; + update_time: STORE s0, time_preserve0 ;preserve contents of registers used during routine + STORE s1, time_preserve1 + STORE s2, time_preserve2 + STORE s3, time_preserve3 + STORE s4, time_preserve4 + STORE s5, time_preserve5 + ; + FETCH s2, us_time_stamp_lsb ;read the previous 'us' time stamp into [s3,s2] + FETCH s3, us_time_stamp_msb + DISABLE INTERRUPT ;Read and store current 'us' time stamp provided by the interrupt + STORE int_counter_lsb, us_time_stamp_lsb ;counter. Interrupts are disabled to ensure that both bytes relate + STORE int_counter_msb, us_time_stamp_msb ;to the same count value. + ENABLE INTERRUPT + FETCH s4, us_time_stamp_lsb ;read the new 'us' time stamp in [s5,s4] + FETCH s5, us_time_stamp_msb ; + SUB s4, s2 ;calculate 'us' time difference [s5,s4] = [s5,s4] - [s3,s2] + SUBCY s5, s3 ; (This works correctly even if counter has rolled over) + FETCH s2, us_time_lsb ;read current 'us' time into [s3,s2] + FETCH s3, us_time_msb + ADD s2, s4 ;add on the elapsed 'us' value [s3,s2] = [s3,s2] + [s5,s4] + ADDCY s3, s5 + ;determine how many 1000us (1ms) units there are (if any) in current 'us' time + LOAD s0, 00 ;reset 'ms' counter + test_1000us: SUB s2, count_1000_lsb ;subtract 1000 from [s3,s2] + SUBCY s3, count_1000_msb + JUMP C, store_us_time ;Carry indicates [s3,s2] was less than 1000us + ADD s0, 01 ;increment 'ms' elapsed because [s3,s2] was more or equal to 1000us + JUMP test_1000us ;repeat to see if more than 1ms has elapsed + store_us_time: ADD s2, count_1000_lsb ;add 1000 to restore 'us' value + ADDCY s3, count_1000_msb + STORE s2, us_time_lsb ;store the current value of 'us' + STORE s3, us_time_msb + ;s0 holds the number of 'ms' elapsed since last update (if any). + FETCH s2, ms_time_lsb ;read current 'ms' time into [s3,s2] + FETCH s3, ms_time_msb + ADD s2, s0 ;add on the elapsed 'ms' value [s3,s2] = [s3,s2] + s0 + ADDCY s3, 00 + ;determine if there are now more than 1000ms to form 1 second. + LOAD s0, 00 ;reset 'second' counter + SUB s2, count_1000_lsb ;subtract 1000 from [s3,s2] + SUBCY s3, count_1000_msb + JUMP C, restore_ms_time ;Carry indicates [s3,s2] was less than 1000ms + ADD s0, 01 ;increment 'second' elapsed because [s3,s2] was more or equal to 1000ms + JUMP store_ms_time ;new value of 'ms' is remainder of subtraction + restore_ms_time: ADD s2, count_1000_lsb ;add 1000 to restore 'ms' value + ADDCY s3, count_1000_msb + store_ms_time: STORE s2, ms_time_lsb ;store the current value of 'ms' + STORE s3, ms_time_msb + ;s0 currently determines if one second needs to be added to the hh:mm:ss clock time + FETCH s1, real_time_seconds ;read seconds + ADD s1, s0 ;add one second if required by s0 + COMPARE s1, seconds_in_a_minute ;test for 1 minute + JUMP Z, inc_minutes + STORE s1, real_time_seconds ;store updated seconds + JUMP time_update_complete + inc_minutes: LOAD s1, 00 ;seconds become zero + STORE s1, real_time_seconds + FETCH s1, real_time_minutes ;read minutes + ADD s1, 01 ;increment minutes + COMPARE s1, minutes_in_an_hour ;test for 1 hour + JUMP Z, inc_hours + STORE s1, real_time_minutes ;store updated minutes + JUMP time_update_complete + inc_hours: LOAD s1, 00 ;minutes become zero + STORE s1, real_time_minutes + FETCH s1, real_time_hours ;read hours + ADD s1, 01 ;increment hours + COMPARE s1, hours_in_a_day ;test for 24 hours + JUMP Z, reset_hours + STORE s1, real_time_hours ;store updated hours + JUMP time_update_complete + reset_hours: LOAD s1, 00 ;hours become zero + STORE s1, real_time_hours + ; + ;With the time updated, there is then a test for time=alarm time + ; + time_update_complete: FETCH s0, real_time_hours + FETCH s1, alarm_time_hours ;compare hours + COMPARE s0, s1 + JUMP NZ, finish_update + FETCH s0, real_time_minutes ;compare minutes + FETCH s1, alarm_time_minutes + COMPARE s0, s1 + JUMP NZ, finish_update + FETCH s0, real_time_seconds ;compare seconds + FETCH s1, alarm_time_seconds + COMPARE s0, s1 + JUMP NZ, finish_update + FETCH s0, alarm_status ;test if alarm is turned on + TEST s0, alarm_armed + JUMP Z, finish_update ;alarm was off + OR s0, alarm_active ;activate alarm + STORE s0, alarm_status + CALL alarm_drive + finish_update: FETCH s0, time_preserve0 ;restore the register contents + FETCH s1, time_preserve1 + FETCH s2, time_preserve2 + FETCH s3, time_preserve3 + FETCH s4, time_preserve4 + FETCH s5, time_preserve5 + RETURN + ; + ;Convert character to upper case + ; + ;The character supplied in register s0. + ;If the character is in the range 'a' to 'z', it is converted + ;to the equivalent upper case character in the range 'A' to 'Z'. + ;All other characters remain unchanged. + ; + ;Registers used s0. + ; + upper_case: COMPARE s0, 61 ;eliminate character codes below 'a' (61 hex) + RETURN C + COMPARE s0, 7B ;eliminate character codes above 'z' (7A hex) + RETURN NC + AND s0, DF ;mask bit5 to convert to upper case + RETURN + ; + ; + ;Convert character '0' to '9' to numerical value in range 0 to 9 + ; + ;The character supplied in register s0. If the character is in the + ;range '0' to '9', it is converted to the equivalent decimal value. + ;Characters not in the range '0' to '9' are signified by the return + ;with the CARRY flag set. + ; + ;Registers used s0. + ; + 1char_to_value: ADD s0, C6 ;reject character codes above '9' (39 hex) + RETURN C ;carry flag is set + SUB s0, F6 ;reject character codes below '0' (30 hex) + RETURN ;carry is set if value not in range + ; + ; + ;Determine the numerical value of a two character decimal string held in + ;scratch pad memory such the result is in the range 0 to 99 (00 to 63 hex). + ; + ;The string must be stored as in two consecutive memory locations and the + ;location of the first (tens) character supplied in the s1 register. + ;The result is provided in register s2. Strings not using characters in the + ;range '0' to '9' are signified by the return with the CARRY flag set. + ; + ;Registers used s0, s1 and s2. + ; + 2char_to_value: FETCH s0, (s1) ;read 'tens' character + CALL 1char_to_value ;convert to numerical value + RETURN C ;bad character - CARRY set + LOAD s2, s0 + SL0 s2 ;multiply 'tens' value by 10 (0A hex) + SL0 s2 + ADD s2, s0 + SL0 s2 + ADD s1, 01 ;read 'units' character + FETCH s0, (s1) + CALL 1char_to_value ;convert to numerical value + RETURN C ;bad character - CARRY set + ADD s2, s0 ;add units to result and clear CARRY flag + RETURN + ; + ; + ;Interrupt service routine (ISR) + ; + ;The interrupt is used to increment a 16-bit counter formed with two registers + ;called [int_counter_msb,int_counter_lsb]. This provides a count of the number + ;of micro-seconds elapsed. The counter is 'free running' in that it will count + ;up to 65,535 and then roll over to zero. The count value is then used in other + ;parts of the program as required and where it is less time critical. + ; + ;The ISR only uses the specified counter registers + ; + ADDRESS 3FC + ISR: ADD int_counter_lsb, 01 ;add 1us to 16-bit counter + ADDCY int_counter_msb, 00 + RETURNI ENABLE + ; + ;Interrupt vector + ; + ADDRESS 3FF + JUMP ISR + ; + ; + ;Useful constants + ; + ; + ;ASCII table + ; + CONSTANT character_a, 61 + CONSTANT character_b, 62 + CONSTANT character_c, 63 + CONSTANT character_d, 64 + CONSTANT character_e, 65 + CONSTANT character_f, 66 + CONSTANT character_g, 67 + CONSTANT character_h, 68 + CONSTANT character_i, 69 + CONSTANT character_j, 6A + CONSTANT character_k, 6B + CONSTANT character_l, 6C + CONSTANT character_m, 6D + CONSTANT character_n, 6E + CONSTANT character_o, 6F + CONSTANT character_p, 70 + CONSTANT character_q, 71 + CONSTANT character_r, 72 + CONSTANT character_s, 73 + CONSTANT character_t, 74 + CONSTANT character_u, 75 + CONSTANT character_v, 76 + CONSTANT character_w, 77 + CONSTANT character_x, 78 + CONSTANT character_y, 79 + CONSTANT character_z, 7A + CONSTANT character_A, 41 + CONSTANT character_B, 42 + CONSTANT character_C, 43 + CONSTANT character_D, 44 + CONSTANT character_E, 45 + CONSTANT character_F, 46 + CONSTANT character_G, 47 + CONSTANT character_H, 48 + CONSTANT character_I, 49 + CONSTANT character_J, 4A + CONSTANT character_K, 4B + CONSTANT character_L, 4C + CONSTANT character_M, 4D + CONSTANT character_N, 4E + CONSTANT character_O, 4F + CONSTANT character_P, 50 + CONSTANT character_Q, 51 + CONSTANT character_R, 52 + CONSTANT character_S, 53 + CONSTANT character_T, 54 + CONSTANT character_U, 55 + CONSTANT character_V, 56 + CONSTANT character_W, 57 + CONSTANT character_X, 58 + CONSTANT character_Y, 59 + CONSTANT character_Z, 5A + CONSTANT character_0, 30 + CONSTANT character_1, 31 + CONSTANT character_2, 32 + CONSTANT character_3, 33 + CONSTANT character_4, 34 + CONSTANT character_5, 35 + CONSTANT character_6, 36 + CONSTANT character_7, 37 + CONSTANT character_8, 38 + CONSTANT character_9, 39 + CONSTANT character_colon, 3A + CONSTANT character_semi_colon, 3B + CONSTANT character_less_than, 3C + CONSTANT character_greater_than, 3E + CONSTANT character_equals, 3D + CONSTANT character_space, 20 + CONSTANT character_CR, 0D ;carriage return + CONSTANT character_question, 3F ;'?' + CONSTANT character_dollar, 24 + CONSTANT character_BS, 08 ;Back Space command character + ; diff --git a/projects/PicoBlaze/ise/UART9_readme.txt b/projects/PicoBlaze/ise/UART9_readme.txt new file mode 100644 index 0000000..c4dbcee --- /dev/null +++ b/projects/PicoBlaze/ise/UART9_readme.txt @@ -0,0 +1,458 @@ +UART9 readme.txt + +Please open this file in Notepad or WordPad or use a non proportional font for best display format. + + + +9-Bit UART Macros with Integral FIFO Buffers. +Suitable for communication with Parity. + + +Release 1 - 3rd March 2005 + + + + +Author +------ + +Ken Chapman +Staff Engineer - Spartan Applications Specialist +Xilinx Ltd (UK) + +email: ken.chapman@xilinx.com + + +Introduction +------------ + +These macros have been supplied to complement the standard 8-bit UART macros supplied with PicoBlaze. +You are advised to look at the standard macros and documentation (UART_manual.pdf) first as these +variants take almost the same format and must be used and controlled in the same fundamental way. + +The UART9 macros provide a UART which has 1 start bit, 9 data bits and 1 stop bit. +The additional data bit can be used to provide different functionality depending on the way you +choose to interpret it. + +Transmitter macro is called 'uart9_tx.vhd' and the additional bit is data_in(8). +Receiver macro is called 'uart9_rx.vhd' and the additional bit is data_out(8). + +Parity - Drive data_in(8) with a High or Low depending on the state or the remaining data bits + data_in(7 downto 0) and the desired ODD or EVEN parity. + Interpret and check the received data_out(8) as required by your application. + +Data - The additional bit can be used as an additional data bit. + +Stop bit - Forcing a High and checking for High allows the UART to provide 1 start bit, 8 data + bits and 2 stop bits format. + + +Is Parity Required? +------------------- + +The most common reason for the 9th bit is to provide support for parity. Before choosing to +implement parity in a system you should ask the fundamental question "Do I really need it?". +To help answer that question, you need to consider what your system will do if a parity error +should occur. Will it just ignore an error and what will be the effect if it does? If it +does not ignore the error, then what will it do? All of these factors will need to be solved +at a higher level than these macros and PicoBlaze will almost certainly provide a suitable +platform in which to implement this protocol. + +In many cases the need for parity is simply to enable connection to another piece of equipment +which expects parity and which can not be changed. It is not unusual in these cases for the received +parity to be ignored or for incorrect data to be discarded with unpredictable results. Fortunately +most serial connections such as RS232 are now very reliable once initial communication has +been established. + + + +Using the Macros +---------------- + +The macros are provided as source VHDL and should be instantiated in your design. Each macro +also uses two sub macros and therefore these files must also be added to the project. + +uart9_tx + | + |__kcuart9_tx + | + |__bbfifo_16x9 + + +uart9_rx + | + |__kcuart9_rx + | + |__bbfifo_16x9 + + +The instantiation templates are exactly the same as those required for the standard 8-bit +macros except that the data bus in each case is now 9 bits. + + +Component declaration........ + +---------------------------------------------------------------------------------------- + + component uart9_tx + Port ( data_in : in std_logic_vector(8 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; + + + component uart9_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; + + +---------------------------------------------------------------------------------------- + +Component Instantiation...... + +Signal names will probably change to fit with your design. + +---------------------------------------------------------------------------------------- + + transmit: uart9_tx + port map ( data_in => data_in, + write_buffer => write_buffer, + reset_buffer => reset_buffer, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + buffer_full => buffer_full, + buffer_half_full => buffer_half_full, + clk => clk ); + + receive: uart9_rx + port map ( serial_in => serial_in, + data_out => data_out + read_buffer => read_buffer + reset_buffer => reset_buffer, + en_16_x_baud => en_16_x_baud, + buffer_data_present => buffer_data_present, + buffer_full => buffer_full, + buffer_half_full => buffer_half_full, + clk => clk ); + + +---------------------------------------------------------------------------------------- + + +Providing Parity +---------------- + +Parity is defined as being ODD or EVEN. The term ODD and EVEN refers to the total number of +High (1) bits being transmitted including the parity bit itself. + +For example the ASCII code for the letter 'A' is 41 hex. The 8-bit binary representation is +therefore 01000001 which clearly has an even number of 1's. So the parity bit will High (1) +for ODD parity and '0' for EVEN parity. + +To transmit parity using the uart9_tx macro, the parity bit needs to be computed and then +applied along with the 8 data bits when activating the write_buffer control. This could be +achieved in hardware by creating an XOR gate for EVEN parity or an XNOR for ODD parity. + +--ODD parity +data_in(8) <= data_in(0) xor data_in(1) xor data_in(2) xor data_in(3) + xor data_in(4) xor data_in(5) xor data_in(6) xor data_in(7); + +PicoBlaze can also be used to calculate parity and may offer additional flexibility. +Since the ports and operation of PicoBlaze is 8-bits, connections to the uart_tx now +requires 2 ports. The first port can be used to provide the parity bit which will then +be held in a register. Then when the second port writes the main 8-bit data directly +into the FIFO buffer the parity bit is combined to form the complete 9-bit value. By +careful design the spare bits of the port used to set the parity bits can also be used +for control the reset on the UART FIFO buffers if required. + +When receiving data, hardware logic could again be used to compute the parity of the data +and compare this with the received parity bit (XNOR gate). This would result in a +'parity error' flag which the associated processor would still need to read. So unless +the processor is really very occupied, it is probably easier and more efficient to read +the parity bit directly and perform the error test in software. + + +---------------------------------------------------------------------------------------- + +PicoBlaze interface to uart9_tx and uart_rx supporting parity. + +The following sections of code describe a potential interface between PicoBlaze and the +uart9 macros. Notice how the FIFO buffers are fully controlled and monitored by the +Processor and the parity bit is treated as bit7 of allocated input and output ports. + +---------------------------------------------------------------------------------------- + +signal rx_data : std_logic_vector(8 downto 0); +signal tx_data : std_logic_vector(8 downto 0); +signal tx_parity : std_logic; +signal write_to_uart : std_logic; +signal tx_full : std_logic; +signal tx_half_full : std_logic; +signal read_from_uart : std_logic; +signal rx_data_present : std_logic; +signal rx_full : std_logic; +signal rx_half_full : std_logic; +signal uart_status : std_logic_vector(7 downto 0); +signal tx_reset : std_logic; +signal rx_reset : std_logic; + +............... + + --UART Transmitter interface + + parity_tx_port: process(clk) + begin + + if clk'event and clk='1' then + if write_strobe='1' then + + -- PORT 20 : UART FIFO control and transmitter parity. + if port_id(5)='1' then + tx_reset <= out_port(0); + rx_reset <= out_port(1); + tx_parity <= out_port(7); + end if; + + end if; + end if; + + end process parity_tx_port; + + -- PORT 10 : Write data to UART transmitter. + write_to_uart <= write_strobe and port_id(4); + + tx_data <= tx_parity & out_port; + + transmit: uart9_tx + port map ( data_in => tx_data, + write_buffer => write_to_uart, + reset_buffer => reset_buffer, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + buffer_full => buffer_full, + buffer_half_full => buffer_half_full, + clk => clk ); + +............... + + --UART Receiver interface + + input_ports: process(clk) + begin + if clk'event and clk='1' then + + case port_id(1 downto 0) is + + --PORT 00 : Read FIFO status including receiver parity bit + when "00" => in_port <= uart_status; + + --PORT 01 : Read receiver UART + when "01" => in_port <= rx_data(7 downto 0); + + --PORT 02 - if required + --when "10" => in_port <= ?????; + + --PORT 03 - if required + --when "11" => in_port <= ?????; + + -- Don't care used to ensure minimum logic + when others => in_port <= "XXXXXXXX"; + + end case; + + -- Form read strobe for UART receiver FIFO buffer for address 01. + + read_from_uart <= read_strobe and (not port_id(1)) and port_id(0); + + end if; + + receive: uart9_rx + port map ( serial_in => rx, + data_out => rx_data, + read_buffer => read_from_uart, + reset_buffer => rx_reset, + en_16_x_baud => en_38400_baud, + buffer_data_present => rx_data_present, + buffer_full => rx_full, + buffer_half_full => rx_half_full, + clk => clk ); + + + uart_status <= rx_data(8) & "00" & rx_full & rx_half_full & rx_data_present & tx_full & tx_half_full ; + + + +---------------------------------------------------------------------------------------- + +PicoBlaze to uart9_tx PSM code example + +The following sections of PSM code relate to the VHDL interface above and enable a byte +of data to be transmitted or received via the UART including parity. CONSTANT directives +have been used to define both the port numbers and the allocations of bits within a given +port. + +The parity generation is performed by the TEST instruction. It is vital that the +transmitter code (UART_write) sets the parity output port first and then writes the +actual data. The receiver code (UART_read) captures the received parity as part of the +polling of the FIFO status bits. It then reads the data, computes parity and compares this +with the received bit. The ZERO flag (Z) indicates any parity errors which can then be +used at the higher level in the program. + +---------------------------------------------------------------------------------------- + + CONSTANT UART_write_port, 10 ;UART Tx 8-bit data output + ; + CONSTANT UART_control_port, 20 ;UART reset and parity output + CONSTANT tx_reset, 01 ; Tx Buffer Reset - bit0 + CONSTANT rx_reset, 02 ; Rx Buffer Reset - bit1 + CONSTANT tx_parity, 80 ; Tx Parity - bit7 + ; + CONSTANT UART_status_port, 00 ;Communications status input + CONSTANT tx_half_full, 01 ; Transmitter half full - bit0 + CONSTANT tx_full, 02 ; UART FIFO full - bit1 + CONSTANT rx_data_present, 04 ; Receiver data present - bit2 + CONSTANT rx_half_full, 08 ; UART FIFO half full - bit3 + CONSTANT rx_full, 10 ; full - bit4 + CONSTANT status_nul5, 20 ; unused - bit5 + CONSTANT status_nul6, 40 ; unused - bit6 + CONSTANT rx_parity, 80 ; Parity Bit parity - bit7 + ; + CONSTANT UART_read_port, 01 ;UART Rx 8-bit data input + ; + + NAMEREG sF, UART_data ;used for main 8-bit UART data + NAMEREG sE, UART_status ;used for UART status and control + ; + + ; + ;Write byte to UART with EVEN or ODD parity. + ; + ;Data should be provided in register 'UART_data' + ; + ;Odd and even Parity is describes the total number of 1's sent + ;in the complete 9-bit packet formed of 8-bit data and the parity bit. + ;For EVEN parity comment out the line indicated ***. + ;For ODD parity include the line indicated ***. + ; + ;Registers used s0, UART_data and UART_status + ; + UART_write: INPUT UART_status, UART_status_port + TEST UART_status, tx_full ;test for space in buffer + JUMP NZ, UART_write ;wait if no space + LOAD s0, 00 ;compute parity for data being sent + TEST UART_data, FF + SRA s0 ;move parity value into MSB + XOR s0, 80 ;**** include this line for ODD parity + OUTPUT s0, UART_control_port ;send parity to UART (no reset) + OUTPUT UART_data, UART_write_port ;write data and parity into transmitter + RETURN + ; + + + ;Read byte from UART with test for EVEN or ODD parity. + ; + ;The routine tests and waits for available data and then reads the byte + ;data into register 'UART_data'. The data is then tested against the parity + ;bit received. For good data the ZERO flag will be set. A parity error will + ;will be signified by the ZERO flag being reset. + ; + ;Odd and even Parity is describes the total number of 1's sent + ;in the complete 9-bit packet formed of 8-bit data and the parity bit. + ;For EVEN parity comment out the line indicated ***. + ;For ODD parity include the line indicated ***. + ; + ;Registers used s0, UART_data and UART_status + ; + ; + UART_read: INPUT UART_status, UART_status_port ;Test for available character + TEST UART_status, rx_data_present ;test for space in buffer + INPUT UART_data, UART_read_port + LOAD s0, 00 ;compute parity for received data + TEST UART_data, FF + SRA s0 + XOR s0, 80 ;****include this line for ODD parity + AND UART_status, rx_parity ;isolate parity bit received + XOR s0, UART_status ;ZERO set if parity matches + RETURN + ; + +---------------------------------------------------------------------------------------- + + + +Simple Error Correction Technique +--------------------------------- + +This is a very old technique which can provide a degree of error correction. Although a +parity error can indicate that an error has occurred, it is not possible to know which bit +has been received in error. This technique can be used to detect and correct the occasional +bit error. + +In this example we assume that 8 bytes of data are to be sent. These are the ASCII characters +ABCDEFGH. First each byte is transmitted with ODD parity (although EVEN could also be used). + +A 0 1 0 0 0 0 0 1 1 +B 0 1 0 0 0 0 1 0 1 +C 0 1 0 0 0 0 1 1 0 +D 0 1 0 0 0 1 0 0 1 +E 0 1 0 0 0 1 0 1 0 +F 0 1 0 0 0 1 1 0 0 +G 0 1 0 0 0 1 1 1 1 +H 0 1 0 0 0 1 0 0 1 + +Next a 'parity byte' is transmitted. Each bit represents the ODD parity of the corresponding bit +transmitted in the last 8 bytes. In other words, it is the ODD parity associated with each of +the above columns. + + 1 1 1 1 1 0 1 1 * + +It is debatable as to what to transmit as parity for this 'parity byte'. It could just be the +parity of the 'parity byte' in the normal way. It could be the parity of the previous 8 parity +bits transmitted or a combination of both. The uart9 macros allow you to make the choice in +software because it is treated the same way as any other data bit. + + +Now consider receiving the above data packet, but with a bit error at bit 6 of the character 'D'. + +A 0 1 0 0 0 0 0 1 1 +B 0 1 0 0 0 0 1 0 1 +C 0 1 0 0 0 0 1 1 0 +D 0 0 0 0 0 1 0 0 1 <----- Parity error +E 0 1 0 0 0 1 0 1 0 +F 0 1 0 0 0 1 1 0 0 +G 0 1 0 0 0 1 1 1 1 +H 0 1 0 0 0 1 0 0 1 + 1 1 1 1 1 0 1 1 * + + ^ + | + parity + error + +The parity error on the 'D' line tells us there has been some kind of error but we do not know +which bit caused it. The 'parity byte' also indicates that an error has occurred in the bit 6 +column, but we don't know which byte was the cause. However, it can easily be seen that the +intersection of these error points reveals the bit error and it would therefore be reasonable +to correct this bit by simple inversion. + +It is possible to correct more than one bit error in a packet so long as the errors occur in +different rows and columns. There is always a danger that the parity bits may be corrupted and +this is where the parity of the 'parity byte' (*) could benefit from being the computation of +all 16 parity bits. + +----------------------------------------------------------------------------------------------- +End of file UART9_readme.txt +----------------------------------------------------------------------------------------------- diff --git a/projects/PicoBlaze/ise/VHDL/UART9_readme.txt b/projects/PicoBlaze/ise/VHDL/UART9_readme.txt new file mode 100644 index 0000000..c4dbcee --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/UART9_readme.txt @@ -0,0 +1,458 @@ +UART9 readme.txt + +Please open this file in Notepad or WordPad or use a non proportional font for best display format. + + + +9-Bit UART Macros with Integral FIFO Buffers. +Suitable for communication with Parity. + + +Release 1 - 3rd March 2005 + + + + +Author +------ + +Ken Chapman +Staff Engineer - Spartan Applications Specialist +Xilinx Ltd (UK) + +email: ken.chapman@xilinx.com + + +Introduction +------------ + +These macros have been supplied to complement the standard 8-bit UART macros supplied with PicoBlaze. +You are advised to look at the standard macros and documentation (UART_manual.pdf) first as these +variants take almost the same format and must be used and controlled in the same fundamental way. + +The UART9 macros provide a UART which has 1 start bit, 9 data bits and 1 stop bit. +The additional data bit can be used to provide different functionality depending on the way you +choose to interpret it. + +Transmitter macro is called 'uart9_tx.vhd' and the additional bit is data_in(8). +Receiver macro is called 'uart9_rx.vhd' and the additional bit is data_out(8). + +Parity - Drive data_in(8) with a High or Low depending on the state or the remaining data bits + data_in(7 downto 0) and the desired ODD or EVEN parity. + Interpret and check the received data_out(8) as required by your application. + +Data - The additional bit can be used as an additional data bit. + +Stop bit - Forcing a High and checking for High allows the UART to provide 1 start bit, 8 data + bits and 2 stop bits format. + + +Is Parity Required? +------------------- + +The most common reason for the 9th bit is to provide support for parity. Before choosing to +implement parity in a system you should ask the fundamental question "Do I really need it?". +To help answer that question, you need to consider what your system will do if a parity error +should occur. Will it just ignore an error and what will be the effect if it does? If it +does not ignore the error, then what will it do? All of these factors will need to be solved +at a higher level than these macros and PicoBlaze will almost certainly provide a suitable +platform in which to implement this protocol. + +In many cases the need for parity is simply to enable connection to another piece of equipment +which expects parity and which can not be changed. It is not unusual in these cases for the received +parity to be ignored or for incorrect data to be discarded with unpredictable results. Fortunately +most serial connections such as RS232 are now very reliable once initial communication has +been established. + + + +Using the Macros +---------------- + +The macros are provided as source VHDL and should be instantiated in your design. Each macro +also uses two sub macros and therefore these files must also be added to the project. + +uart9_tx + | + |__kcuart9_tx + | + |__bbfifo_16x9 + + +uart9_rx + | + |__kcuart9_rx + | + |__bbfifo_16x9 + + +The instantiation templates are exactly the same as those required for the standard 8-bit +macros except that the data bus in each case is now 9 bits. + + +Component declaration........ + +---------------------------------------------------------------------------------------- + + component uart9_tx + Port ( data_in : in std_logic_vector(8 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; + + + component uart9_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; + + +---------------------------------------------------------------------------------------- + +Component Instantiation...... + +Signal names will probably change to fit with your design. + +---------------------------------------------------------------------------------------- + + transmit: uart9_tx + port map ( data_in => data_in, + write_buffer => write_buffer, + reset_buffer => reset_buffer, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + buffer_full => buffer_full, + buffer_half_full => buffer_half_full, + clk => clk ); + + receive: uart9_rx + port map ( serial_in => serial_in, + data_out => data_out + read_buffer => read_buffer + reset_buffer => reset_buffer, + en_16_x_baud => en_16_x_baud, + buffer_data_present => buffer_data_present, + buffer_full => buffer_full, + buffer_half_full => buffer_half_full, + clk => clk ); + + +---------------------------------------------------------------------------------------- + + +Providing Parity +---------------- + +Parity is defined as being ODD or EVEN. The term ODD and EVEN refers to the total number of +High (1) bits being transmitted including the parity bit itself. + +For example the ASCII code for the letter 'A' is 41 hex. The 8-bit binary representation is +therefore 01000001 which clearly has an even number of 1's. So the parity bit will High (1) +for ODD parity and '0' for EVEN parity. + +To transmit parity using the uart9_tx macro, the parity bit needs to be computed and then +applied along with the 8 data bits when activating the write_buffer control. This could be +achieved in hardware by creating an XOR gate for EVEN parity or an XNOR for ODD parity. + +--ODD parity +data_in(8) <= data_in(0) xor data_in(1) xor data_in(2) xor data_in(3) + xor data_in(4) xor data_in(5) xor data_in(6) xor data_in(7); + +PicoBlaze can also be used to calculate parity and may offer additional flexibility. +Since the ports and operation of PicoBlaze is 8-bits, connections to the uart_tx now +requires 2 ports. The first port can be used to provide the parity bit which will then +be held in a register. Then when the second port writes the main 8-bit data directly +into the FIFO buffer the parity bit is combined to form the complete 9-bit value. By +careful design the spare bits of the port used to set the parity bits can also be used +for control the reset on the UART FIFO buffers if required. + +When receiving data, hardware logic could again be used to compute the parity of the data +and compare this with the received parity bit (XNOR gate). This would result in a +'parity error' flag which the associated processor would still need to read. So unless +the processor is really very occupied, it is probably easier and more efficient to read +the parity bit directly and perform the error test in software. + + +---------------------------------------------------------------------------------------- + +PicoBlaze interface to uart9_tx and uart_rx supporting parity. + +The following sections of code describe a potential interface between PicoBlaze and the +uart9 macros. Notice how the FIFO buffers are fully controlled and monitored by the +Processor and the parity bit is treated as bit7 of allocated input and output ports. + +---------------------------------------------------------------------------------------- + +signal rx_data : std_logic_vector(8 downto 0); +signal tx_data : std_logic_vector(8 downto 0); +signal tx_parity : std_logic; +signal write_to_uart : std_logic; +signal tx_full : std_logic; +signal tx_half_full : std_logic; +signal read_from_uart : std_logic; +signal rx_data_present : std_logic; +signal rx_full : std_logic; +signal rx_half_full : std_logic; +signal uart_status : std_logic_vector(7 downto 0); +signal tx_reset : std_logic; +signal rx_reset : std_logic; + +............... + + --UART Transmitter interface + + parity_tx_port: process(clk) + begin + + if clk'event and clk='1' then + if write_strobe='1' then + + -- PORT 20 : UART FIFO control and transmitter parity. + if port_id(5)='1' then + tx_reset <= out_port(0); + rx_reset <= out_port(1); + tx_parity <= out_port(7); + end if; + + end if; + end if; + + end process parity_tx_port; + + -- PORT 10 : Write data to UART transmitter. + write_to_uart <= write_strobe and port_id(4); + + tx_data <= tx_parity & out_port; + + transmit: uart9_tx + port map ( data_in => tx_data, + write_buffer => write_to_uart, + reset_buffer => reset_buffer, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + buffer_full => buffer_full, + buffer_half_full => buffer_half_full, + clk => clk ); + +............... + + --UART Receiver interface + + input_ports: process(clk) + begin + if clk'event and clk='1' then + + case port_id(1 downto 0) is + + --PORT 00 : Read FIFO status including receiver parity bit + when "00" => in_port <= uart_status; + + --PORT 01 : Read receiver UART + when "01" => in_port <= rx_data(7 downto 0); + + --PORT 02 - if required + --when "10" => in_port <= ?????; + + --PORT 03 - if required + --when "11" => in_port <= ?????; + + -- Don't care used to ensure minimum logic + when others => in_port <= "XXXXXXXX"; + + end case; + + -- Form read strobe for UART receiver FIFO buffer for address 01. + + read_from_uart <= read_strobe and (not port_id(1)) and port_id(0); + + end if; + + receive: uart9_rx + port map ( serial_in => rx, + data_out => rx_data, + read_buffer => read_from_uart, + reset_buffer => rx_reset, + en_16_x_baud => en_38400_baud, + buffer_data_present => rx_data_present, + buffer_full => rx_full, + buffer_half_full => rx_half_full, + clk => clk ); + + + uart_status <= rx_data(8) & "00" & rx_full & rx_half_full & rx_data_present & tx_full & tx_half_full ; + + + +---------------------------------------------------------------------------------------- + +PicoBlaze to uart9_tx PSM code example + +The following sections of PSM code relate to the VHDL interface above and enable a byte +of data to be transmitted or received via the UART including parity. CONSTANT directives +have been used to define both the port numbers and the allocations of bits within a given +port. + +The parity generation is performed by the TEST instruction. It is vital that the +transmitter code (UART_write) sets the parity output port first and then writes the +actual data. The receiver code (UART_read) captures the received parity as part of the +polling of the FIFO status bits. It then reads the data, computes parity and compares this +with the received bit. The ZERO flag (Z) indicates any parity errors which can then be +used at the higher level in the program. + +---------------------------------------------------------------------------------------- + + CONSTANT UART_write_port, 10 ;UART Tx 8-bit data output + ; + CONSTANT UART_control_port, 20 ;UART reset and parity output + CONSTANT tx_reset, 01 ; Tx Buffer Reset - bit0 + CONSTANT rx_reset, 02 ; Rx Buffer Reset - bit1 + CONSTANT tx_parity, 80 ; Tx Parity - bit7 + ; + CONSTANT UART_status_port, 00 ;Communications status input + CONSTANT tx_half_full, 01 ; Transmitter half full - bit0 + CONSTANT tx_full, 02 ; UART FIFO full - bit1 + CONSTANT rx_data_present, 04 ; Receiver data present - bit2 + CONSTANT rx_half_full, 08 ; UART FIFO half full - bit3 + CONSTANT rx_full, 10 ; full - bit4 + CONSTANT status_nul5, 20 ; unused - bit5 + CONSTANT status_nul6, 40 ; unused - bit6 + CONSTANT rx_parity, 80 ; Parity Bit parity - bit7 + ; + CONSTANT UART_read_port, 01 ;UART Rx 8-bit data input + ; + + NAMEREG sF, UART_data ;used for main 8-bit UART data + NAMEREG sE, UART_status ;used for UART status and control + ; + + ; + ;Write byte to UART with EVEN or ODD parity. + ; + ;Data should be provided in register 'UART_data' + ; + ;Odd and even Parity is describes the total number of 1's sent + ;in the complete 9-bit packet formed of 8-bit data and the parity bit. + ;For EVEN parity comment out the line indicated ***. + ;For ODD parity include the line indicated ***. + ; + ;Registers used s0, UART_data and UART_status + ; + UART_write: INPUT UART_status, UART_status_port + TEST UART_status, tx_full ;test for space in buffer + JUMP NZ, UART_write ;wait if no space + LOAD s0, 00 ;compute parity for data being sent + TEST UART_data, FF + SRA s0 ;move parity value into MSB + XOR s0, 80 ;**** include this line for ODD parity + OUTPUT s0, UART_control_port ;send parity to UART (no reset) + OUTPUT UART_data, UART_write_port ;write data and parity into transmitter + RETURN + ; + + + ;Read byte from UART with test for EVEN or ODD parity. + ; + ;The routine tests and waits for available data and then reads the byte + ;data into register 'UART_data'. The data is then tested against the parity + ;bit received. For good data the ZERO flag will be set. A parity error will + ;will be signified by the ZERO flag being reset. + ; + ;Odd and even Parity is describes the total number of 1's sent + ;in the complete 9-bit packet formed of 8-bit data and the parity bit. + ;For EVEN parity comment out the line indicated ***. + ;For ODD parity include the line indicated ***. + ; + ;Registers used s0, UART_data and UART_status + ; + ; + UART_read: INPUT UART_status, UART_status_port ;Test for available character + TEST UART_status, rx_data_present ;test for space in buffer + INPUT UART_data, UART_read_port + LOAD s0, 00 ;compute parity for received data + TEST UART_data, FF + SRA s0 + XOR s0, 80 ;****include this line for ODD parity + AND UART_status, rx_parity ;isolate parity bit received + XOR s0, UART_status ;ZERO set if parity matches + RETURN + ; + +---------------------------------------------------------------------------------------- + + + +Simple Error Correction Technique +--------------------------------- + +This is a very old technique which can provide a degree of error correction. Although a +parity error can indicate that an error has occurred, it is not possible to know which bit +has been received in error. This technique can be used to detect and correct the occasional +bit error. + +In this example we assume that 8 bytes of data are to be sent. These are the ASCII characters +ABCDEFGH. First each byte is transmitted with ODD parity (although EVEN could also be used). + +A 0 1 0 0 0 0 0 1 1 +B 0 1 0 0 0 0 1 0 1 +C 0 1 0 0 0 0 1 1 0 +D 0 1 0 0 0 1 0 0 1 +E 0 1 0 0 0 1 0 1 0 +F 0 1 0 0 0 1 1 0 0 +G 0 1 0 0 0 1 1 1 1 +H 0 1 0 0 0 1 0 0 1 + +Next a 'parity byte' is transmitted. Each bit represents the ODD parity of the corresponding bit +transmitted in the last 8 bytes. In other words, it is the ODD parity associated with each of +the above columns. + + 1 1 1 1 1 0 1 1 * + +It is debatable as to what to transmit as parity for this 'parity byte'. It could just be the +parity of the 'parity byte' in the normal way. It could be the parity of the previous 8 parity +bits transmitted or a combination of both. The uart9 macros allow you to make the choice in +software because it is treated the same way as any other data bit. + + +Now consider receiving the above data packet, but with a bit error at bit 6 of the character 'D'. + +A 0 1 0 0 0 0 0 1 1 +B 0 1 0 0 0 0 1 0 1 +C 0 1 0 0 0 0 1 1 0 +D 0 0 0 0 0 1 0 0 1 <----- Parity error +E 0 1 0 0 0 1 0 1 0 +F 0 1 0 0 0 1 1 0 0 +G 0 1 0 0 0 1 1 1 1 +H 0 1 0 0 0 1 0 0 1 + 1 1 1 1 1 0 1 1 * + + ^ + | + parity + error + +The parity error on the 'D' line tells us there has been some kind of error but we do not know +which bit caused it. The 'parity byte' also indicates that an error has occurred in the bit 6 +column, but we don't know which byte was the cause. However, it can easily be seen that the +intersection of these error points reveals the bit error and it would therefore be reasonable +to correct this bit by simple inversion. + +It is possible to correct more than one bit error in a packet so long as the errors occur in +different rows and columns. There is always a danger that the parity bits may be corrupted and +this is where the parity of the 'parity byte' (*) could benefit from being the computation of +all 16 parity bits. + +----------------------------------------------------------------------------------------------- +End of file UART9_readme.txt +----------------------------------------------------------------------------------------------- diff --git a/projects/PicoBlaze/ise/VHDL/bbfifo_16x8.vhd b/projects/PicoBlaze/ise/VHDL/bbfifo_16x8.vhd new file mode 100644 index 0000000..8ef61e6 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/bbfifo_16x8.vhd @@ -0,0 +1,281 @@ +-- 'Bucket Brigade' FIFO +-- 16 deep +-- 8-bit data +-- +-- Version : 1.10 +-- Version Date : 3rd December 2003 +-- Reason : '--translate' directives changed to '--synthesis translate' directives +-- +-- Version : 1.00 +-- Version Date : 14th October 2002 +-- +-- Start of design entry : 14th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for BBFIFO_16x8 +-- +entity bbfifo_16x8 is + Port ( data_in : in std_logic_vector(7 downto 0); + data_out : out std_logic_vector(7 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end bbfifo_16x8; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for BBFIFO_16x8 +-- +architecture low_level_definition of bbfifo_16x8 is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in BBFIFO_16x8 +-- +------------------------------------------------------------------------------------ +-- +signal pointer : std_logic_vector(3 downto 0); +signal next_count : std_logic_vector(3 downto 0); +signal half_count : std_logic_vector(3 downto 0); +signal count_carry : std_logic_vector(2 downto 0); + +signal pointer_zero : std_logic; +signal pointer_full : std_logic; +signal decode_data_present : std_logic; +signal data_present_int : std_logic; +signal valid_write : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of zero_lut : label is "0001"; +attribute INIT of full_lut : label is "8000"; +attribute INIT of dp_lut : label is "BFA0"; +attribute INIT of valid_lut : label is "C4"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of BBFIFO_16x8 circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- SRL16E data storage + + data_width_loop: for i in 0 to 7 generate + -- + attribute INIT : string; + attribute INIT of data_srl : label is "0000"; + -- + begin + + data_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_in(i), + CE => valid_write, + CLK => clk, + A0 => pointer(0), + A1 => pointer(1), + A2 => pointer(2), + A3 => pointer(3), + Q => data_out(i) ); + + end generate data_width_loop; + + -- 4-bit counter to act as data pointer + -- Counter is clock enabled by 'data_present' + -- Counter will be reset when 'reset' is active + -- Counter will increment when 'valid_write' is active + + count_width_loop: for i in 0 to 3 generate + -- + attribute INIT : string; + attribute INIT of count_lut : label is "6606"; + -- + begin + + register_bit: FDRE + port map ( D => next_count(i), + Q => pointer(i), + CE => data_present_int, + R => reset, + C => clk); + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6606") + --synthesis translate_on + port map( I0 => pointer(i), + I1 => read, + I2 => pointer_zero, + I3 => write, + O => half_count(i)); + + lsb_count: if i=0 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => valid_write, + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => valid_write, + O => next_count(i)); + + end generate lsb_count; + + mid_count: if i>0 and i<3 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => count_carry(i-1), + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate mid_count; + + upper_count: if i=3 generate + begin + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate upper_count; + + end generate count_width_loop; + + + -- Detect when pointer is zero and maximum + + zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_zero ); + + + full_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"8000") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_full ); + + + -- Data Present status + + dp_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"BFA0") + --synthesis translate_on + port map( I0 => write, + I1 => read, + I2 => pointer_zero, + I3 => data_present_int, + O => decode_data_present ); + + dp_flop: FDR + port map ( D => decode_data_present, + Q => data_present_int, + R => reset, + C => clk); + + -- Valid write signal + + valid_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"C4") + --synthesis translate_on + port map( I0 => pointer_full, + I1 => write, + I2 => read, + O => valid_write ); + + + -- assign internal signals to outputs + + full <= pointer_full; + half_full <= pointer(3); + data_present <= data_present_int; + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE BBFIFO_16x8.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/bbfifo_16x9.vhd b/projects/PicoBlaze/ise/VHDL/bbfifo_16x9.vhd new file mode 100644 index 0000000..dc57e4d --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/bbfifo_16x9.vhd @@ -0,0 +1,275 @@ +-- 'Bucket Brigade' FIFO +-- 16 deep +-- 9-bit data +-- +-- Version : 1.00 (derived from bbfifo_16x8 version 1.10) +-- Version Date : 10th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for BBFIFO_16x9 +-- +entity bbfifo_16x9 is + Port ( data_in : in std_logic_vector(8 downto 0); + data_out : out std_logic_vector(8 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end bbfifo_16x9; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for BBFIFO_16x9 +-- +architecture low_level_definition of bbfifo_16x9 is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in BBFIFO_16x9 +-- +------------------------------------------------------------------------------------ +-- +signal pointer : std_logic_vector(3 downto 0); +signal next_count : std_logic_vector(3 downto 0); +signal half_count : std_logic_vector(3 downto 0); +signal count_carry : std_logic_vector(2 downto 0); + +signal pointer_zero : std_logic; +signal pointer_full : std_logic; +signal decode_data_present : std_logic; +signal data_present_int : std_logic; +signal valid_write : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of zero_lut : label is "0001"; +attribute INIT of full_lut : label is "8000"; +attribute INIT of dp_lut : label is "BFA0"; +attribute INIT of valid_lut : label is "C4"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of BBFIFO_16x9 circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- SRL16E data storage + + data_width_loop: for i in 0 to 8 generate + -- + attribute INIT : string; + attribute INIT of data_srl : label is "0000"; + -- + begin + + data_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_in(i), + CE => valid_write, + CLK => clk, + A0 => pointer(0), + A1 => pointer(1), + A2 => pointer(2), + A3 => pointer(3), + Q => data_out(i) ); + + end generate data_width_loop; + + -- 4-bit counter to act as data pointer + -- Counter is clock enabled by 'data_present' + -- Counter will be reset when 'reset' is active + -- Counter will increment when 'valid_write' is active + + count_width_loop: for i in 0 to 3 generate + -- + attribute INIT : string; + attribute INIT of count_lut : label is "6606"; + -- + begin + + register_bit: FDRE + port map ( D => next_count(i), + Q => pointer(i), + CE => data_present_int, + R => reset, + C => clk); + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6606") + --synthesis translate_on + port map( I0 => pointer(i), + I1 => read, + I2 => pointer_zero, + I3 => write, + O => half_count(i)); + + lsb_count: if i=0 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => valid_write, + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => valid_write, + O => next_count(i)); + + end generate lsb_count; + + mid_count: if i>0 and i<3 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => count_carry(i-1), + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate mid_count; + + upper_count: if i=3 generate + begin + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate upper_count; + + end generate count_width_loop; + + + -- Detect when pointer is zero and maximum + + zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_zero ); + + + full_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"8000") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_full ); + + + -- Data Present status + + dp_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"BFA0") + --synthesis translate_on + port map( I0 => write, + I1 => read, + I2 => pointer_zero, + I3 => data_present_int, + O => decode_data_present ); + + dp_flop: FDR + port map ( D => decode_data_present, + Q => data_present_int, + R => reset, + C => clk); + + -- Valid write signal + + valid_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"C4") + --synthesis translate_on + port map( I0 => pointer_full, + I1 => write, + I2 => read, + O => valid_write ); + + + -- assign internal signals to outputs + + full <= pointer_full; + half_full <= pointer(3); + data_present <= data_present_int; + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE BBFIFO_16x9.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/embedded_kcpsm3.vhd b/projects/PicoBlaze/ise/VHDL/embedded_kcpsm3.vhd new file mode 100644 index 0000000..1ac4c60 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/embedded_kcpsm3.vhd @@ -0,0 +1,106 @@ +-- +-- EMBEDDED_KCPSM3.VHD +-- +-- Ken Chapman - Xilinx Ltd - 3rd June 2003 +-- +-- This file instantiates the KCPSM3 processor macro and connects the +-- program ROM. +-- +-- NOTE: The name of the program ROM will probably need to be changed to +-- reflect the name of the program (PSM) file applied to the assembler. +-- +------------------------------------------------------------------------------------ +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +------------------------------------------------------------------------------------ +-- +-- +entity embedded_kcpsm3 is + Port ( port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + read_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); +end embedded_kcpsm3; +-- +------------------------------------------------------------------------------------ +-- +-- Start of test achitecture +-- +architecture connectivity of embedded_kcpsm3 is +-- +------------------------------------------------------------------------------------ +-- +-- declaration of KCPSM3 +-- + component kcpsm3 + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end component; +-- +-- declaration of program ROM +-- + component prog_rom + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used to connect KCPSM3 to program ROM +-- +signal address : std_logic_vector(9 downto 0); +signal instruction : std_logic_vector(17 downto 0); +-- +------------------------------------------------------------------------------------ +-- +-- Start of test circuit description +-- +begin + + processor: kcpsm3 + port map( address => address, + instruction => instruction, + port_id => port_id, + write_strobe => write_strobe, + out_port => out_port, + read_strobe => read_strobe, + in_port => in_port, + interrupt => interrupt, + interrupt_ack => interrupt_ack, + reset => reset, + clk => clk); + + program: prog_rom + port map( address => address, + instruction => instruction, + clk => clk); + +end connectivity; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE EMBEDDED_KCPSM3.VHD +-- +------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/ise/VHDL/kcpsm3.vhd b/projects/PicoBlaze/ise/VHDL/kcpsm3.vhd new file mode 100644 index 0000000..e1e5804 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/kcpsm3.vhd @@ -0,0 +1,1901 @@ +-- PicoBlaze +-- +-- Constant (K) Coded Programmable State Machine for Spartan-3 Devices. +-- Also suitable for use with Virtex-II(PRO) and Virtex-4 devices. +-- +-- Includes additional code for enhanced VHDL simulation. +-- +-- Version : 1.30 +-- Version Date : 14th June 2004 +-- Reasons : Avoid issue caused when ENABLE INTERRUPT is used when interrupts are +-- already enabled when an an interrupt input is applied. +-- Improved design for faster ZERO and CARRY flag logic +-- +-- +-- Previous Version : 1.20 +-- Version Date : 9th July 2003 +-- +-- Start of design entry : 19th May 2003 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +-- Instruction disassembly concept inspired by the work of Prof. Dr.-Ing. Bernhard Lang. +-- University of Applied Sciences, Osnabrueck, Germany. +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2003. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Furthermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Format of this file. +-- +-- This file contains the definition of KCPSM3 as one complete module with sections +-- created using generate loops. This 'flat' approach has been adopted to decrease +-- the time taken to load the module into simulators and the synthesis process. +-- +-- The module defines the implementation of the logic using Xilinx primitives. +-- These ensure predictable synthesis results and maximise the density of the implementation. +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCPSM3 +-- +entity kcpsm3 is + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end kcpsm3; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCPSM3 +-- +architecture low_level_definition of kcpsm3 is +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCPSM3 +-- +------------------------------------------------------------------------------------ +-- +-- Fundamental control and decode signals +-- +signal t_state : std_logic; +signal not_t_state : std_logic; +signal internal_reset : std_logic; +signal reset_delay : std_logic; +signal move_group : std_logic; +signal condition_met : std_logic; +signal normal_count : std_logic; +signal call_type : std_logic; +signal push_or_pop_type : std_logic; +signal valid_to_move : std_logic; +-- +-- Flag signals +-- +signal flag_type : std_logic; +signal flag_write : std_logic; +signal flag_enable : std_logic; +signal zero_flag : std_logic; +signal sel_shadow_zero : std_logic; +signal low_zero : std_logic; +signal high_zero : std_logic; +signal low_zero_carry : std_logic; +signal high_zero_carry : std_logic; +signal zero_carry : std_logic; +signal zero_fast_route : std_logic; +signal low_parity : std_logic; +signal high_parity : std_logic; +signal parity_carry : std_logic; +signal parity : std_logic; +signal carry_flag : std_logic; +signal sel_parity : std_logic; +signal sel_arith_carry : std_logic; +signal sel_shift_carry : std_logic; +signal sel_shadow_carry : std_logic; +signal sel_carry : std_logic_vector(3 downto 0); +signal carry_fast_route : std_logic; +-- +-- Interrupt signals +-- +signal active_interrupt : std_logic; +signal int_pulse : std_logic; +signal clean_int : std_logic; +signal shadow_carry : std_logic; +signal shadow_zero : std_logic; +signal int_enable : std_logic; +signal int_update_enable : std_logic; +signal int_enable_value : std_logic; +signal interrupt_ack_internal : std_logic; +-- +-- Program Counter signals +-- +signal pc : std_logic_vector(9 downto 0); +signal pc_vector : std_logic_vector(9 downto 0); +signal pc_vector_carry : std_logic_vector(8 downto 0); +signal inc_pc_vector : std_logic_vector(9 downto 0); +signal pc_value : std_logic_vector(9 downto 0); +signal pc_value_carry : std_logic_vector(8 downto 0); +signal inc_pc_value : std_logic_vector(9 downto 0); +signal pc_enable : std_logic; +-- +-- Data Register signals +-- +signal sx : std_logic_vector(7 downto 0); +signal sy : std_logic_vector(7 downto 0); +signal register_type : std_logic; +signal register_write : std_logic; +signal register_enable : std_logic; +signal second_operand : std_logic_vector(7 downto 0); +-- +-- Scratch Pad Memory signals +-- +signal memory_data : std_logic_vector(7 downto 0); +signal store_data : std_logic_vector(7 downto 0); +signal memory_type : std_logic; +signal memory_write : std_logic; +signal memory_enable : std_logic; +-- +-- Stack signals +-- +signal stack_pop_data : std_logic_vector(9 downto 0); +signal stack_ram_data : std_logic_vector(9 downto 0); +signal stack_address : std_logic_vector(4 downto 0); +signal half_stack_address : std_logic_vector(4 downto 0); +signal stack_address_carry : std_logic_vector(3 downto 0); +signal next_stack_address : std_logic_vector(4 downto 0); +signal stack_write_enable : std_logic; +signal not_active_interrupt : std_logic; +-- +-- ALU signals +-- +signal logical_result : std_logic_vector(7 downto 0); +signal logical_value : std_logic_vector(7 downto 0); +signal sel_logical : std_logic; +signal shift_result : std_logic_vector(7 downto 0); +signal shift_value : std_logic_vector(7 downto 0); +signal sel_shift : std_logic; +signal high_shift_in : std_logic; +signal low_shift_in : std_logic; +signal shift_in : std_logic; +signal shift_carry : std_logic; +signal shift_carry_value : std_logic; +signal arith_result : std_logic_vector(7 downto 0); +signal arith_value : std_logic_vector(7 downto 0); +signal half_arith : std_logic_vector(7 downto 0); +signal arith_internal_carry : std_logic_vector(7 downto 0); +signal sel_arith_carry_in : std_logic; +signal arith_carry_in : std_logic; +signal invert_arith_carry : std_logic; +signal arith_carry_out : std_logic; +signal sel_arith : std_logic; +signal arith_carry : std_logic; +-- +-- ALU multiplexer signals +-- +signal input_fetch_type : std_logic; +signal sel_group : std_logic; +signal alu_group : std_logic_vector(7 downto 0); +signal input_group : std_logic_vector(7 downto 0); +signal alu_result : std_logic_vector(7 downto 0); +-- +-- read and write strobes +-- +signal io_initial_decode : std_logic; +signal write_active : std_logic; +signal read_active : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation for primitives not +-- contained within generate loops. In each case the information is repeated +-- in the generic map for functional simulation +-- +attribute INIT : string; +attribute INIT of t_state_lut : label is "1"; +attribute INIT of int_pulse_lut : label is "0080"; +attribute INIT of int_update_lut : label is "EAAA"; +attribute INIT of int_value_lut : label is "04"; +attribute INIT of move_group_lut : label is "7400"; +attribute INIT of condition_met_lut : label is "5A3C"; +attribute INIT of normal_count_lut : label is "2F"; +attribute INIT of call_type_lut : label is "1000"; +attribute INIT of push_pop_lut : label is "5400"; +attribute INIT of valid_move_lut : label is "D"; +attribute INIT of flag_type_lut : label is "41FC"; +attribute INIT of flag_enable_lut : label is "8"; +attribute INIT of low_zero_lut : label is "0001"; +attribute INIT of high_zero_lut : label is "0001"; +attribute INIT of sel_shadow_zero_lut : label is "3F"; +attribute INIT of low_parity_lut : label is "6996"; +attribute INIT of high_parity_lut : label is "6996"; +attribute INIT of sel_parity_lut : label is "F3FF"; +attribute INIT of sel_arith_carry_lut : label is "F3"; +attribute INIT of sel_shift_carry_lut : label is "C"; +attribute INIT of sel_shadow_carry_lut : label is "3"; +attribute INIT of register_type_lut : label is "0145"; +attribute INIT of register_enable_lut : label is "8"; +attribute INIT of memory_type_lut : label is "0400"; +attribute INIT of memory_enable_lut : label is "8000"; +attribute INIT of sel_logical_lut : label is "FFE2"; +attribute INIT of low_shift_in_lut : label is "E4"; +attribute INIT of high_shift_in_lut : label is "E4"; +attribute INIT of shift_carry_lut : label is "E4"; +attribute INIT of sel_arith_lut : label is "1F"; +attribute INIT of input_fetch_type_lut : label is "0002"; +attribute INIT of io_decode_lut : label is "0010"; +attribute INIT of write_active_lut : label is "4000"; +attribute INIT of read_active_lut : label is "0100"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCPSM3 circuit description +-- +------------------------------------------------------------------------------------ +-- +begin +-- +------------------------------------------------------------------------------------ +-- +-- Fundamental Control +-- +-- Definition of T-state and internal reset +-- +------------------------------------------------------------------------------------ +-- + t_state_lut: LUT1 + --synthesis translate_off + generic map (INIT => X"1") + --synthesis translate_on + port map( I0 => t_state, + O => not_t_state ); + + toggle_flop: FDR + port map ( D => not_t_state, + Q => t_state, + R => internal_reset, + C => clk); + + reset_flop1: FDS + port map ( D => '0', + Q => reset_delay, + S => reset, + C => clk); + + reset_flop2: FDS + port map ( D => reset_delay, + Q => internal_reset, + S => reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- Interrupt input logic, Interrupt enable and shadow Flags. +-- +-- Captures interrupt input and enables the shadow flags. +-- Decodes instructions which set and reset the interrupt enable flip-flop. +-- +------------------------------------------------------------------------------------ +-- + + -- Interrupt capture + + int_capture_flop: FDR + port map ( D => interrupt, + Q => clean_int, + R => internal_reset, + C => clk); + + int_pulse_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0080") + --synthesis translate_on + port map( I0 => t_state, + I1 => clean_int, + I2 => int_enable, + I3 => active_interrupt, + O => int_pulse ); + + int_flop: FDR + port map ( D => int_pulse, + Q => active_interrupt, + R => internal_reset, + C => clk); + + ack_flop: FD + port map ( D => active_interrupt, + Q => interrupt_ack_internal, + C => clk); + + interrupt_ack <= interrupt_ack_internal; + + -- Shadow flags + + shadow_carry_flop: FDE + port map ( D => carry_flag, + Q => shadow_carry, + CE => active_interrupt, + C => clk); + + shadow_zero_flop: FDE + port map ( D => zero_flag, + Q => shadow_zero, + CE => active_interrupt, + C => clk); + + -- Decode instructions that set or reset interrupt enable + + int_update_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"EAAA") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => int_update_enable ); + + int_value_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"04") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(0), + I2 => interrupt_ack_internal, + O => int_enable_value ); + + int_enable_flop: FDRE + port map ( D => int_enable_value, + Q => int_enable, + CE => int_update_enable, + R => internal_reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- Decodes for the control of the program counter and CALL/RETURN stack +-- +------------------------------------------------------------------------------------ +-- + move_group_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"7400") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => move_group ); + + condition_met_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"5A3C") + --synthesis translate_on + port map( I0 => carry_flag, + I1 => zero_flag, + I2 => instruction(10), + I3 => instruction(11), + O => condition_met ); + + normal_count_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"2F") + --synthesis translate_on + port map( I0 => instruction(12), + I1 => condition_met, + I2 => move_group, + O => normal_count ); + + call_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"1000") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => call_type ); + + push_pop_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"5400") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => push_or_pop_type ); + + valid_move_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"D") + --synthesis translate_on + port map( I0 => instruction(12), + I1 => condition_met, + O => valid_to_move ); +-- +------------------------------------------------------------------------------------ +-- +-- The ZERO and CARRY Flags +-- +------------------------------------------------------------------------------------ +-- + -- Enable for flags + + flag_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"41FC") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => flag_type ); + + flag_write_flop: FD + port map ( D => flag_type, + Q => flag_write, + C => clk); + + flag_enable_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => t_state, + I1 => flag_write, + O => flag_enable ); + + -- Zero Flag + + low_zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => alu_result(0), + I1 => alu_result(1), + I2 => alu_result(2), + I3 => alu_result(3), + O => low_zero ); + + high_zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => alu_result(4), + I1 => alu_result(5), + I2 => alu_result(6), + I3 => alu_result(7), + O => high_zero ); + + low_zero_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => low_zero, + O => low_zero_carry ); + + high_zero_cymux: MUXCY + port map( DI => '0', + CI => low_zero_carry, + S => high_zero, + O => high_zero_carry ); + + sel_shadow_zero_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"3F") + --synthesis translate_on + port map( I0 => shadow_zero, + I1 => instruction(16), + I2 => instruction(17), + O => sel_shadow_zero ); + + zero_cymux: MUXCY + port map( DI => shadow_zero, + CI => high_zero_carry, + S => sel_shadow_zero, + O => zero_carry ); + + zero_xor: XORCY + port map( LI => '0', + CI => zero_carry, + O => zero_fast_route); + + zero_flag_flop: FDRE + port map ( D => zero_fast_route, + Q => zero_flag, + CE => flag_enable, + R => internal_reset, + C => clk); + + -- Parity detection + + low_parity_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6996") + --synthesis translate_on + port map( I0 => logical_result(0), + I1 => logical_result(1), + I2 => logical_result(2), + I3 => logical_result(3), + O => low_parity ); + + high_parity_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6996") + --synthesis translate_on + port map( I0 => logical_result(4), + I1 => logical_result(5), + I2 => logical_result(6), + I3 => logical_result(7), + O => high_parity ); + + parity_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => low_parity, + O => parity_carry ); + + parity_xor: XORCY + port map( LI => high_parity, + CI => parity_carry, + O => parity); + + -- CARRY flag selection + + sel_parity_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"F3FF") + --synthesis translate_on + port map( I0 => parity, + I1 => instruction(13), + I2 => instruction(15), + I3 => instruction(16), + O => sel_parity ); + + sel_arith_carry_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"F3") + --synthesis translate_on + port map( I0 => arith_carry, + I1 => instruction(16), + I2 => instruction(17), + O => sel_arith_carry ); + + sel_shift_carry_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"C") + --synthesis translate_on + port map( I0 => shift_carry, + I1 => instruction(15), + O => sel_shift_carry ); + + sel_shadow_carry_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"3") + --synthesis translate_on + port map( I0 => shadow_carry, + I1 => instruction(17), + O => sel_shadow_carry ); + + sel_shadow_muxcy: MUXCY + port map( DI => shadow_carry, + CI => '0', + S => sel_shadow_carry, + O => sel_carry(0) ); + + sel_shift_muxcy: MUXCY + port map( DI => shift_carry, + CI => sel_carry(0), + S => sel_shift_carry, + O => sel_carry(1) ); + + sel_arith_muxcy: MUXCY + port map( DI => arith_carry, + CI => sel_carry(1), + S => sel_arith_carry, + O => sel_carry(2) ); + + sel_parity_muxcy: MUXCY + port map( DI => parity, + CI => sel_carry(2), + S => sel_parity, + O => sel_carry(3) ); + + carry_xor: XORCY + port map( LI => '0', + CI => sel_carry(3), + O => carry_fast_route); + + carry_flag_flop: FDRE + port map ( D => carry_fast_route, + Q => carry_flag, + CE => flag_enable, + R => internal_reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- The Program Counter +-- +-- Definition of a 10-bit counter which can be loaded from two sources +-- +------------------------------------------------------------------------------------ +-- + + invert_enable: INV -- Inverter should be implemented in the CE to flip flops + port map( I => t_state, + O => pc_enable); + + pc_loop: for i in 0 to 9 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of vector_select_mux : label is "E4"; + attribute INIT of value_select_mux : label is "E4"; + -- + begin + + vector_select_mux: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(15), + I1 => instruction(i), + I2 => stack_pop_data(i), + O => pc_vector(i) ); + + value_select_mux: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => normal_count, + I1 => inc_pc_vector(i), + I2 => pc(i), + O => pc_value(i) ); + + register_bit: FDRSE + port map ( D => inc_pc_value(i), + Q => pc(i), + R => internal_reset, + S => active_interrupt, + CE => pc_enable, + C => clk); + + pc_lsb_carry: if i=0 generate + begin + + pc_vector_muxcy: MUXCY + port map( DI => '0', + CI => instruction(13), + S => pc_vector(i), + O => pc_vector_carry(i)); + + pc_vector_xor: XORCY + port map( LI => pc_vector(i), + CI => instruction(13), + O => inc_pc_vector(i)); + + pc_value_muxcy: MUXCY + port map( DI => '0', + CI => normal_count, + S => pc_value(i), + O => pc_value_carry(i)); + + pc_value_xor: XORCY + port map( LI => pc_value(i), + CI => normal_count, + O => inc_pc_value(i)); + + end generate pc_lsb_carry; + + pc_mid_carry: if i>0 and i<9 generate + begin + + pc_vector_muxcy: MUXCY + port map( DI => '0', + CI => pc_vector_carry(i-1), + S => pc_vector(i), + O => pc_vector_carry(i)); + + pc_vector_xor: XORCY + port map( LI => pc_vector(i), + CI => pc_vector_carry(i-1), + O => inc_pc_vector(i)); + + pc_value_muxcy: MUXCY + port map( DI => '0', + CI => pc_value_carry(i-1), + S => pc_value(i), + O => pc_value_carry(i)); + + pc_value_xor: XORCY + port map( LI => pc_value(i), + CI => pc_value_carry(i-1), + O => inc_pc_value(i)); + + end generate pc_mid_carry; + + pc_msb_carry: if i=9 generate + begin + + pc_vector_xor: XORCY + port map( LI => pc_vector(i), + CI => pc_vector_carry(i-1), + O => inc_pc_vector(i)); + + pc_value_xor: XORCY + port map( LI => pc_value(i), + CI => pc_value_carry(i-1), + O => inc_pc_value(i)); + + end generate pc_msb_carry; + + end generate pc_loop; + + address <= pc; +-- +------------------------------------------------------------------------------------ +-- +-- Register Bank and second operand selection. +-- +-- Definition of an 8-bit dual port RAM with 16 locations +-- including write enable decode. +-- +-- Outputs are assigned to PORT_ID and OUT_PORT. +-- +------------------------------------------------------------------------------------ +-- + -- Forming decode signal + + register_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0145") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => register_type ); + + register_write_flop: FD + port map ( D => register_type, + Q => register_write, + C => clk); + + register_enable_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => t_state, + I1 => register_write, + O => register_enable ); + + reg_loop: for i in 0 to 7 generate + -- + -- Attribute to define RAM contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of register_bit : label is "0000"; + attribute INIT of operand_select_mux : label is "E4"; + -- + begin + + register_bit: RAM16X1D + --synthesis translate_off + generic map(INIT => X"0000") + --synthesis translate_on + port map ( D => alu_result(i), + WE => register_enable, + WCLK => clk, + A0 => instruction(8), + A1 => instruction(9), + A2 => instruction(10), + A3 => instruction(11), + DPRA0 => instruction(4), + DPRA1 => instruction(5), + DPRA2 => instruction(6), + DPRA3 => instruction(7), + SPO => sx(i), + DPO => sy(i)); + + operand_select_mux: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(12), + I1 => instruction(i), + I2 => sy(i), + O => second_operand(i) ); + + end generate reg_loop; + + out_port <= sx; + port_id <= second_operand; +-- +------------------------------------------------------------------------------------ +-- +-- Store Memory +-- +-- Definition of an 8-bit single port RAM with 64 locations +-- including write enable decode. +-- +------------------------------------------------------------------------------------ +-- + -- Forming decode signal + + memory_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0400") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => memory_type ); + + memory_write_flop: FD + port map ( D => memory_type, + Q => memory_write, + C => clk); + + memory_enable_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"8000") + --synthesis translate_on + port map( I0 => t_state, + I1 => instruction(13), + I2 => instruction(14), + I3 => memory_write, + O => memory_enable ); + + store_loop: for i in 0 to 7 generate + -- + -- Attribute to define RAM contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of memory_bit : label is "0000000000000000"; + -- + begin + + memory_bit: RAM64X1S + --synthesis translate_off + generic map(INIT => X"0000000000000000") + --synthesis translate_on + port map ( D => sx(i), + WE => memory_enable, + WCLK => clk, + A0 => second_operand(0), + A1 => second_operand(1), + A2 => second_operand(2), + A3 => second_operand(3), + A4 => second_operand(4), + A5 => second_operand(5), + O => memory_data(i)); + + store_flop: FD + port map ( D => memory_data(i), + Q => store_data(i), + C => clk); + + end generate store_loop; +-- +------------------------------------------------------------------------------------ +-- +-- Logical operations +-- +-- Definition of AND, OR, XOR and LOAD functions which also provides TEST. +-- Includes pipeline stage used to form ALU multiplexer including decode. +-- +------------------------------------------------------------------------------------ +-- + sel_logical_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"FFE2") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => sel_logical ); + + logical_loop: for i in 0 to 7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of logical_lut : label is "6E8A"; + -- + begin + + logical_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6E8A") + --synthesis translate_on + port map( I0 => second_operand(i), + I1 => sx(i), + I2 => instruction(13), + I3 => instruction(14), + O => logical_value(i)); + + logical_flop: FDR + port map ( D => logical_value(i), + Q => logical_result(i), + R => sel_logical, + C => clk); + + end generate logical_loop; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Shift and Rotate operations +-- +-- Includes pipeline stage used to form ALU multiplexer including decode. +-- +------------------------------------------------------------------------------------ +-- + sel_shift_inv: INV -- Inverter should be implemented in the reset to flip flops + port map( I => instruction(17), + O => sel_shift); + + -- Bit to input to shift register + + high_shift_in_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(1), + I1 => sx(0), + I2 => instruction(0), + O => high_shift_in ); + + low_shift_in_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(1), + I1 => carry_flag, + I2 => sx(7), + O => low_shift_in ); + + shift_in_muxf5: MUXF5 + port map( I1 => high_shift_in, + I0 => low_shift_in, + S => instruction(2), + O => shift_in ); + + -- Forming shift carry signal + + shift_carry_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => sx(7), + I2 => sx(0), + O => shift_carry_value ); + + pipeline_bit: FD + port map ( D => shift_carry_value, + Q => shift_carry, + C => clk); + + shift_loop: for i in 0 to 7 generate + begin + + lsb_shift: if i=0 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of shift_mux_lut : label is "E4"; + -- + begin + + shift_mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => shift_in, + I2 => sx(i+1), + O => shift_value(i) ); + + end generate lsb_shift; + + mid_shift: if i>0 and i<7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of shift_mux_lut : label is "E4"; + -- + begin + + shift_mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => sx(i-1), + I2 => sx(i+1), + O => shift_value(i) ); + + end generate mid_shift; + + msb_shift: if i=7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of shift_mux_lut : label is "E4"; + -- + begin + + shift_mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => sx(i-1), + I2 => shift_in, + O => shift_value(i) ); + + end generate msb_shift; + + shift_flop: FDR + port map ( D => shift_value(i), + Q => shift_result(i), + R => sel_shift, + C => clk); + + end generate shift_loop; +-- +------------------------------------------------------------------------------------ +-- +-- Arithmetic operations +-- +-- Definition of ADD, ADDCY, SUB and SUBCY functions which also provides COMPARE. +-- Includes pipeline stage used to form ALU multiplexer including decode. +-- +------------------------------------------------------------------------------------ +-- + sel_arith_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"1F") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + O => sel_arith ); + + arith_loop: for i in 0 to 7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of arith_lut : label is "96"; + -- + begin + + lsb_arith: if i=0 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of arith_carry_in_lut : label is "6C"; + -- + begin + + arith_carry_in_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"6C") + --synthesis translate_on + port map( I0 => instruction(13), + I1 => instruction(14), + I2 => carry_flag, + O => sel_arith_carry_in ); + + arith_carry_in_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => sel_arith_carry_in, + O => arith_carry_in); + + arith_muxcy: MUXCY + port map( DI => sx(i), + CI => arith_carry_in, + S => half_arith(i), + O => arith_internal_carry(i)); + + arith_xor: XORCY + port map( LI => half_arith(i), + CI => arith_carry_in, + O => arith_value(i)); + + end generate lsb_arith; + + mid_arith: if i>0 and i<7 generate + begin + + arith_muxcy: MUXCY + port map( DI => sx(i), + CI => arith_internal_carry(i-1), + S => half_arith(i), + O => arith_internal_carry(i)); + + arith_xor: XORCY + port map( LI => half_arith(i), + CI => arith_internal_carry(i-1), + O => arith_value(i)); + + end generate mid_arith; + + msb_arith: if i=7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of arith_carry_out_lut : label is "2"; + -- + begin + + arith_muxcy: MUXCY + port map( DI => sx(i), + CI => arith_internal_carry(i-1), + S => half_arith(i), + O => arith_internal_carry(i)); + + arith_xor: XORCY + port map( LI => half_arith(i), + CI => arith_internal_carry(i-1), + O => arith_value(i)); + + arith_carry_out_lut: LUT1 + --synthesis translate_off + generic map (INIT => X"2") + --synthesis translate_on + port map( I0 => instruction(14), + O => invert_arith_carry ); + + arith_carry_out_xor: XORCY + port map( LI => invert_arith_carry, + CI => arith_internal_carry(i), + O => arith_carry_out); + + arith_carry_flop: FDR + port map ( D => arith_carry_out, + Q => arith_carry, + R => sel_arith, + C => clk); + + end generate msb_arith; + + arith_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"96") + --synthesis translate_on + port map( I0 => sx(i), + I1 => second_operand(i), + I2 => instruction(14), + O => half_arith(i)); + + arith_flop: FDR + port map ( D => arith_value(i), + Q => arith_result(i), + R => sel_arith, + C => clk); + + end generate arith_loop; +-- +-- +------------------------------------------------------------------------------------ +-- +-- ALU multiplexer +-- +------------------------------------------------------------------------------------ +-- + input_fetch_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0002") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => input_fetch_type ); + + sel_group_flop: FD + port map ( D => input_fetch_type, + Q => sel_group, + C => clk); + + alu_mux_loop: for i in 0 to 7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of or_lut : label is "FE"; + attribute INIT of mux_lut : label is "E4"; + -- + begin + + or_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"FE") + --synthesis translate_on + port map( I0 => logical_result(i), + I1 => arith_result(i), + I2 => shift_result(i), + O => alu_group(i)); + + mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(13), + I1 => in_port(i), + I2 => store_data(i), + O => input_group(i)); + + shift_in_muxf5: MUXF5 + port map( I1 => input_group(i), + I0 => alu_group(i), + S => sel_group, + O => alu_result(i) ); + + end generate alu_mux_loop; +-- +------------------------------------------------------------------------------------ +-- +-- Read and Write Strobes +-- +------------------------------------------------------------------------------------ +-- + io_decode_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0010") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(13), + I2 => instruction(14), + I3 => instruction(16), + O => io_initial_decode ); + + write_active_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"4000") + --synthesis translate_on + port map( I0 => t_state, + I1 => instruction(15), + I2 => instruction(17), + I3 => io_initial_decode, + O => write_active ); + + write_strobe_flop: FDR + port map ( D => write_active, + Q => write_strobe, + R => internal_reset, + C => clk); + + read_active_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0100") + --synthesis translate_on + port map( I0 => t_state, + I1 => instruction(15), + I2 => instruction(17), + I3 => io_initial_decode, + O => read_active ); + + read_strobe_flop: FDR + port map ( D => read_active, + Q => read_strobe, + R => internal_reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- Program CALL/RETURN stack +-- +-- Provided the counter and memory for a 32 deep stack supporting nested +-- subroutine calls to a depth of 31 levels. +-- +------------------------------------------------------------------------------------ +-- + -- Stack memory is 32 locations of 10-bit single port. + + stack_ram_inv: INV -- Inverter should be implemented in the WE to RAM + port map( I => t_state, + O => stack_write_enable); + + stack_ram_loop: for i in 0 to 9 generate + -- + -- Attribute to define RAM contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of stack_bit : label is "00000000"; + -- + begin + + stack_bit: RAM32X1S + --synthesis translate_off + generic map(INIT => X"00000000") + --synthesis translate_on + port map ( D => pc(i), + WE => stack_write_enable, + WCLK => clk, + A0 => stack_address(0), + A1 => stack_address(1), + A2 => stack_address(2), + A3 => stack_address(3), + A4 => stack_address(4), + O => stack_ram_data(i)); + + stack_flop: FD + port map ( D => stack_ram_data(i), + Q => stack_pop_data(i), + C => clk); + + end generate stack_ram_loop; + + -- Stack address pointer is a 5-bit counter + + stack_count_inv: INV -- Inverter should be implemented in the CE to the flip-flops + port map( I => active_interrupt, + O => not_active_interrupt); + + stack_count_loop: for i in 0 to 4 generate + begin + + register_bit: FDRE + port map ( D => next_stack_address(i), + Q => stack_address(i), + R => internal_reset, + CE => not_active_interrupt, + C => clk); + + lsb_stack_count: if i=0 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of count_lut : label is "6555"; + -- + begin + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6555") + --synthesis translate_on + port map( I0 => stack_address(i), + I1 => t_state, + I2 => valid_to_move, + I3 => push_or_pop_type, + O => half_stack_address(i) ); + + count_muxcy: MUXCY + port map( DI => stack_address(i), + CI => '0', + S => half_stack_address(i), + O => stack_address_carry(i)); + + count_xor: XORCY + port map( LI => half_stack_address(i), + CI => '0', + O => next_stack_address(i)); + + end generate lsb_stack_count; + + mid_stack_count: if i>0 and i<4 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of count_lut : label is "A999"; + -- + begin + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"A999") + --synthesis translate_on + port map( I0 => stack_address(i), + I1 => t_state, + I2 => valid_to_move, + I3 => call_type, + O => half_stack_address(i) ); + + count_muxcy: MUXCY + port map( DI => stack_address(i), + CI => stack_address_carry(i-1), + S => half_stack_address(i), + O => stack_address_carry(i)); + + count_xor: XORCY + port map( LI => half_stack_address(i), + CI => stack_address_carry(i-1), + O => next_stack_address(i)); + + end generate mid_stack_count; + + + msb_stack_count: if i=4 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of count_lut : label is "A999"; + -- + begin + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"A999") + --synthesis translate_on + port map( I0 => stack_address(i), + I1 => t_state, + I2 => valid_to_move, + I3 => call_type, + O => half_stack_address(i) ); + + count_xor: XORCY + port map( LI => half_stack_address(i), + CI => stack_address_carry(i-1), + O => next_stack_address(i)); + + end generate msb_stack_count; + + end generate stack_count_loop; + +-- +------------------------------------------------------------------------------------ +-- +-- End of description for KCPSM3 macro. +-- +------------------------------------------------------------------------------------ +-- +--********************************************************************************** +-- Code for simulation purposes only after this line +--********************************************************************************** +-- +------------------------------------------------------------------------------------ +-- +-- Code for simulation. +-- +-- Disassemble the instruction codes to form a text string variable for display. +-- Determine status of reset and flags and present in the form of a text string. +-- Provide a local variables to simulate the contents of each register and scratch +-- pad memory location. +-- +------------------------------------------------------------------------------------ +-- + --All of this section is ignored during synthesis. + --synthesis translate off + + simulation: process (clk, instruction) + -- + --complete instruction decode + -- + variable kcpsm3_opcode : string(1 to 19); + -- + --Status of flags and processor + -- + variable kcpsm3_status : string(1 to 13):= "NZ, NC, Reset"; + + -- + --contents of each register + -- + variable s0_contents : std_logic_vector(7 downto 0):=X"00"; + variable s1_contents : std_logic_vector(7 downto 0):=X"00"; + variable s2_contents : std_logic_vector(7 downto 0):=X"00"; + variable s3_contents : std_logic_vector(7 downto 0):=X"00"; + variable s4_contents : std_logic_vector(7 downto 0):=X"00"; + variable s5_contents : std_logic_vector(7 downto 0):=X"00"; + variable s6_contents : std_logic_vector(7 downto 0):=X"00"; + variable s7_contents : std_logic_vector(7 downto 0):=X"00"; + variable s8_contents : std_logic_vector(7 downto 0):=X"00"; + variable s9_contents : std_logic_vector(7 downto 0):=X"00"; + variable sa_contents : std_logic_vector(7 downto 0):=X"00"; + variable sb_contents : std_logic_vector(7 downto 0):=X"00"; + variable sc_contents : std_logic_vector(7 downto 0):=X"00"; + variable sd_contents : std_logic_vector(7 downto 0):=X"00"; + variable se_contents : std_logic_vector(7 downto 0):=X"00"; + variable sf_contents : std_logic_vector(7 downto 0):=X"00"; + -- + --contents of each scratch pad memory location + -- + variable spm00_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm01_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm02_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm03_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm04_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm05_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm06_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm07_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm08_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm09_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0f_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm10_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm11_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm12_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm13_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm14_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm15_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm16_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm17_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm18_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm19_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1f_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm20_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm21_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm22_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm23_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm24_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm25_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm26_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm27_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm28_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm29_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2f_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm30_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm31_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm32_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm33_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm34_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm35_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm36_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm37_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm38_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm39_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3f_contents : std_logic_vector(7 downto 0):=X"00"; + -- + --temporary variables + -- + variable sx_decode : string(1 to 2); --sX register specification + variable sy_decode : string(1 to 2); --sY register specification + variable kk_decode : string(1 to 2); --constant value specification + variable aaa_decode : string(1 to 3); --address specification + -- + -------------------------------------------------------------------------------- + -- + -- Function to convert 4-bit binary nibble to hexadecimal character + -- + -------------------------------------------------------------------------------- + -- + function hexcharacter (nibble: std_logic_vector(3 downto 0)) + return character is + variable hex: character; + begin + case nibble is + when "0000" => hex := '0'; + when "0001" => hex := '1'; + when "0010" => hex := '2'; + when "0011" => hex := '3'; + when "0100" => hex := '4'; + when "0101" => hex := '5'; + when "0110" => hex := '6'; + when "0111" => hex := '7'; + when "1000" => hex := '8'; + when "1001" => hex := '9'; + when "1010" => hex := 'A'; + when "1011" => hex := 'B'; + when "1100" => hex := 'C'; + when "1101" => hex := 'D'; + when "1110" => hex := 'E'; + when "1111" => hex := 'F'; + when others => hex := 'x'; + end case; + return hex; + end hexcharacter; + -- + -------------------------------------------------------------------------------- + -- + begin + + -- decode first register + sx_decode(1) := 's'; + sx_decode(2) := hexcharacter(instruction(11 downto 8)); + + -- decode second register + sy_decode(1) := 's'; + sy_decode(2) := hexcharacter(instruction(7 downto 4)); + + -- decode constant value + kk_decode(1) := hexcharacter(instruction(7 downto 4)); + kk_decode(2) := hexcharacter(instruction(3 downto 0)); + + -- address value + aaa_decode(1) := hexcharacter("00" & instruction(9 downto 8)); + aaa_decode(2) := hexcharacter(instruction(7 downto 4)); + aaa_decode(3) := hexcharacter(instruction(3 downto 0)); + + -- decode instruction + case instruction(17 downto 12) is + when "000000" => kcpsm3_opcode := "LOAD " & sx_decode & ',' & kk_decode & " "; + when "000001" => kcpsm3_opcode := "LOAD " & sx_decode & ',' & sy_decode & " "; + when "001010" => kcpsm3_opcode := "AND " & sx_decode & ',' & kk_decode & " "; + when "001011" => kcpsm3_opcode := "AND " & sx_decode & ',' & sy_decode & " "; + when "001100" => kcpsm3_opcode := "OR " & sx_decode & ',' & kk_decode & " "; + when "001101" => kcpsm3_opcode := "OR " & sx_decode & ',' & sy_decode & " "; + when "001110" => kcpsm3_opcode := "XOR " & sx_decode & ',' & kk_decode & " "; + when "001111" => kcpsm3_opcode := "XOR " & sx_decode & ',' & sy_decode & " "; + when "010010" => kcpsm3_opcode := "TEST " & sx_decode & ',' & kk_decode & " "; + when "010011" => kcpsm3_opcode := "TEST " & sx_decode & ',' & sy_decode & " "; + when "011000" => kcpsm3_opcode := "ADD " & sx_decode & ',' & kk_decode & " "; + when "011001" => kcpsm3_opcode := "ADD " & sx_decode & ',' & sy_decode & " "; + when "011010" => kcpsm3_opcode := "ADDCY " & sx_decode & ',' & kk_decode & " "; + when "011011" => kcpsm3_opcode := "ADDCY " & sx_decode & ',' & sy_decode & " "; + when "011100" => kcpsm3_opcode := "SUB " & sx_decode & ',' & kk_decode & " "; + when "011101" => kcpsm3_opcode := "SUB " & sx_decode & ',' & sy_decode & " "; + when "011110" => kcpsm3_opcode := "SUBCY " & sx_decode & ',' & kk_decode & " "; + when "011111" => kcpsm3_opcode := "SUBCY " & sx_decode & ',' & sy_decode & " "; + when "010100" => kcpsm3_opcode := "COMPARE " & sx_decode & ',' & kk_decode & " "; + when "010101" => kcpsm3_opcode := "COMPARE " & sx_decode & ',' & sy_decode & " "; + when "100000" => + case instruction(3 downto 0) is + when "0110" => kcpsm3_opcode := "SL0 " & sx_decode & " "; + when "0111" => kcpsm3_opcode := "SL1 " & sx_decode & " "; + when "0100" => kcpsm3_opcode := "SLX " & sx_decode & " "; + when "0000" => kcpsm3_opcode := "SLA " & sx_decode & " "; + when "0010" => kcpsm3_opcode := "RL " & sx_decode & " "; + when "1110" => kcpsm3_opcode := "SR0 " & sx_decode & " "; + when "1111" => kcpsm3_opcode := "SR1 " & sx_decode & " "; + when "1010" => kcpsm3_opcode := "SRX " & sx_decode & " "; + when "1000" => kcpsm3_opcode := "SRA " & sx_decode & " "; + when "1100" => kcpsm3_opcode := "RR " & sx_decode & " "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "101100" => kcpsm3_opcode := "OUTPUT " & sx_decode & ',' & kk_decode & " "; + when "101101" => kcpsm3_opcode := "OUTPUT " & sx_decode & ",(" & sy_decode & ") "; + when "000100" => kcpsm3_opcode := "INPUT " & sx_decode & ',' & kk_decode & " "; + when "000101" => kcpsm3_opcode := "INPUT " & sx_decode & ",(" & sy_decode & ") "; + when "101110" => kcpsm3_opcode := "STORE " & sx_decode & ',' & kk_decode & " "; + when "101111" => kcpsm3_opcode := "STORE " & sx_decode & ",(" & sy_decode & ") "; + when "000110" => kcpsm3_opcode := "FETCH " & sx_decode & ',' & kk_decode & " "; + when "000111" => kcpsm3_opcode := "FETCH " & sx_decode & ",(" & sy_decode & ") "; + when "110100" => kcpsm3_opcode := "JUMP " & aaa_decode & " "; + when "110101" => + case instruction(11 downto 10) is + when "00" => kcpsm3_opcode := "JUMP Z," & aaa_decode & " "; + when "01" => kcpsm3_opcode := "JUMP NZ," & aaa_decode & " "; + when "10" => kcpsm3_opcode := "JUMP C," & aaa_decode & " "; + when "11" => kcpsm3_opcode := "JUMP NC," & aaa_decode & " "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "110000" => kcpsm3_opcode := "CALL " & aaa_decode & " "; + when "110001" => + case instruction(11 downto 10) is + when "00" => kcpsm3_opcode := "CALL Z," & aaa_decode & " "; + when "01" => kcpsm3_opcode := "CALL NZ," & aaa_decode & " "; + when "10" => kcpsm3_opcode := "CALL C," & aaa_decode & " "; + when "11" => kcpsm3_opcode := "CALL NC," & aaa_decode & " "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "101010" => kcpsm3_opcode := "RETURN "; + when "101011" => + case instruction(11 downto 10) is + when "00" => kcpsm3_opcode := "RETURN Z "; + when "01" => kcpsm3_opcode := "RETURN NZ "; + when "10" => kcpsm3_opcode := "RETURN C "; + when "11" => kcpsm3_opcode := "RETURN NC "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "111000" => + case instruction(0) is + when '0' => kcpsm3_opcode := "RETURNI DISABLE "; + when '1' => kcpsm3_opcode := "RETURNI ENABLE "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "111100" => + case instruction(0) is + when '0' => kcpsm3_opcode := "DISABLE INTERRUPT "; + when '1' => kcpsm3_opcode := "ENABLE INTERRUPT "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + + if clk'event and clk='1' then + + --reset and flag status information + if reset='1' or reset_delay='1' then + kcpsm3_status := "NZ, NC, Reset"; + else + kcpsm3_status(7 to 13) := " "; + if flag_enable='1' then + if zero_carry='1' then + kcpsm3_status(1 to 4) := " Z, "; + else + kcpsm3_status(1 to 4) := "NZ, "; + end if; + if sel_carry(3)='1' then + kcpsm3_status(5 to 6) := " C"; + else + kcpsm3_status(5 to 6) := "NC"; + end if; + end if; + end if; + + --simulation of register contents + if register_enable='1' then + case instruction(11 downto 8) is + when "0000" => s0_contents := alu_result; + when "0001" => s1_contents := alu_result; + when "0010" => s2_contents := alu_result; + when "0011" => s3_contents := alu_result; + when "0100" => s4_contents := alu_result; + when "0101" => s5_contents := alu_result; + when "0110" => s6_contents := alu_result; + when "0111" => s7_contents := alu_result; + when "1000" => s8_contents := alu_result; + when "1001" => s9_contents := alu_result; + when "1010" => sa_contents := alu_result; + when "1011" => sb_contents := alu_result; + when "1100" => sc_contents := alu_result; + when "1101" => sd_contents := alu_result; + when "1110" => se_contents := alu_result; + when "1111" => sf_contents := alu_result; + when others => null; + end case; + end if; + + --simulation of scratch pad memory contents + if memory_enable='1' then + case second_operand(5 downto 0) is + when "000000" => spm00_contents := sx; + when "000001" => spm01_contents := sx; + when "000010" => spm02_contents := sx; + when "000011" => spm03_contents := sx; + when "000100" => spm04_contents := sx; + when "000101" => spm05_contents := sx; + when "000110" => spm06_contents := sx; + when "000111" => spm07_contents := sx; + when "001000" => spm08_contents := sx; + when "001001" => spm09_contents := sx; + when "001010" => spm0a_contents := sx; + when "001011" => spm0b_contents := sx; + when "001100" => spm0c_contents := sx; + when "001101" => spm0d_contents := sx; + when "001110" => spm0e_contents := sx; + when "001111" => spm0f_contents := sx; + when "010000" => spm10_contents := sx; + when "010001" => spm11_contents := sx; + when "010010" => spm12_contents := sx; + when "010011" => spm13_contents := sx; + when "010100" => spm14_contents := sx; + when "010101" => spm15_contents := sx; + when "010110" => spm16_contents := sx; + when "010111" => spm17_contents := sx; + when "011000" => spm18_contents := sx; + when "011001" => spm19_contents := sx; + when "011010" => spm1a_contents := sx; + when "011011" => spm1b_contents := sx; + when "011100" => spm1c_contents := sx; + when "011101" => spm1d_contents := sx; + when "011110" => spm1e_contents := sx; + when "011111" => spm1f_contents := sx; + when "100000" => spm20_contents := sx; + when "100001" => spm21_contents := sx; + when "100010" => spm22_contents := sx; + when "100011" => spm23_contents := sx; + when "100100" => spm24_contents := sx; + when "100101" => spm25_contents := sx; + when "100110" => spm26_contents := sx; + when "100111" => spm27_contents := sx; + when "101000" => spm28_contents := sx; + when "101001" => spm29_contents := sx; + when "101010" => spm2a_contents := sx; + when "101011" => spm2b_contents := sx; + when "101100" => spm2c_contents := sx; + when "101101" => spm2d_contents := sx; + when "101110" => spm2e_contents := sx; + when "101111" => spm2f_contents := sx; + when "110000" => spm30_contents := sx; + when "110001" => spm31_contents := sx; + when "110010" => spm32_contents := sx; + when "110011" => spm33_contents := sx; + when "110100" => spm34_contents := sx; + when "110101" => spm35_contents := sx; + when "110110" => spm36_contents := sx; + when "110111" => spm37_contents := sx; + when "111000" => spm38_contents := sx; + when "111001" => spm39_contents := sx; + when "111010" => spm3a_contents := sx; + when "111011" => spm3b_contents := sx; + when "111100" => spm3c_contents := sx; + when "111101" => spm3d_contents := sx; + when "111110" => spm3e_contents := sx; + when "111111" => spm3f_contents := sx; + when others => null; + end case; + end if; + + end if; + + end process simulation; + + --synthesis translate on +-- +--********************************************************************************** +-- End of simulation code. +--********************************************************************************** +-- +-- +end low_level_definition; +-- +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCPSM3.VHD +-- +------------------------------------------------------------------------------------ diff --git a/projects/PicoBlaze/ise/VHDL/kcpsm3_int_test.vhd b/projects/PicoBlaze/ise/VHDL/kcpsm3_int_test.vhd new file mode 100644 index 0000000..2b422c9 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/kcpsm3_int_test.vhd @@ -0,0 +1,155 @@ +-- +-- Interrupt test for KCPSM3 +-- +-- Ken Chapman - Xilinx Ltd - June 2003 +-- +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +------------------------------------------------------------------------------------ +-- +-- +entity kcpsm3_int_test is + Port ( counter : out std_logic_vector(7 downto 0); + waveforms : out std_logic_vector(7 downto 0); + interrupt_event : in std_logic; + clk : in std_logic); + end kcpsm3_int_test; +-- +------------------------------------------------------------------------------------ +-- +-- Start of test achitecture +-- +architecture Behavioral of kcpsm3_int_test is +-- +------------------------------------------------------------------------------------ +-- +-- declaration of KCPSM3 +-- + component kcpsm3 + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end component; +-- +-- declaration of program ROM +-- + component int_test + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used to connect KCPSM3 to program ROM and I/O logic +-- +signal address : std_logic_vector(9 downto 0); +signal instruction : std_logic_vector(17 downto 0); +signal port_id : std_logic_vector(7 downto 0); +signal out_port : std_logic_vector(7 downto 0); +signal in_port : std_logic_vector(7 downto 0); +signal write_strobe : std_logic; +signal read_strobe : std_logic; +signal interrupt : std_logic :='0'; +signal interrupt_ack : std_logic; +signal reset : std_logic; +-- +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- +-- Start of circuit description +-- +begin + + -- Inserting KCPSM3 and the program memory + + processor: kcpsm3 + port map( address => address, + instruction => instruction, + port_id => port_id, + write_strobe => write_strobe, + out_port => out_port, + read_strobe => read_strobe, + in_port => in_port, + interrupt => interrupt, + interrupt_ack => interrupt_ack, + reset => reset, + clk => clk); + + program: int_test + port map( address => address, + instruction => instruction, + clk => clk); + + -- Unused inputs on processor + + in_port <= "00000000"; + reset <= '0'; + + -- Adding the output registers to the processor + + IO_registers: process(clk) + begin + + if clk'event and clk='1' then + + -- waveform register at address 02 + if port_id(1)='1' and write_strobe='1' then + waveforms <= out_port; + end if; + + -- Interrupt Counter register at address 04 + if port_id(2)='1' and write_strobe='1' then + counter <= out_port; + end if; + + end if; + + end process IO_registers; + + + + -- Adding the interrupt input + -- Note that the initial value of interrupt (low) is + -- defined at signal declaration. + + interrupt_control: process(clk) + begin + + if clk'event and clk='1' then + if interrupt_ack='1' then + interrupt <= '0'; + elsif interrupt_event='1' then + interrupt <= '1'; + else + interrupt <= interrupt; + end if; + end if; + + end process interrupt_control; + +end Behavioral; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCPSM3_INT_TEST.VHD +-- +------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/ise/VHDL/kcuart9_rx.vhd b/projects/PicoBlaze/ise/VHDL/kcuart9_rx.vhd new file mode 100644 index 0000000..e995ead --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/kcuart9_rx.vhd @@ -0,0 +1,351 @@ +-- 9-Bit Constant (K) Compact UART Receiver +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be checked externally and is provided as data_out(8). +-- +-- Version : 1.00 (derived from kcuart_rx version 1.00) +-- Version Date : 11th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART9_RX +-- +entity kcuart9_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end kcuart9_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART9_RX +-- +architecture low_level_definition of kcuart9_rx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART9_RX +-- +------------------------------------------------------------------------------------ +-- +signal sync_serial : std_logic; +signal stop_bit : std_logic; +signal data_int : std_logic_vector(8 downto 0); +signal data_delay : std_logic_vector(8 downto 0); +signal start_delay : std_logic; +signal start_bit : std_logic; +signal edge_delay : std_logic; +signal start_edge : std_logic; +signal decode_valid_char : std_logic; +signal valid_char : std_logic; +signal decode_purge : std_logic; +signal purge : std_logic; +signal valid_srl_delay : std_logic_vector(9 downto 0); +signal valid_reg_delay : std_logic_vector(9 downto 0); +signal decode_data_strobe : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of start_srl : label is "0000"; +attribute INIT of edge_srl : label is "0000"; +attribute INIT of valid_lut : label is "0040"; +attribute INIT of purge_lut : label is "54"; +attribute INIT of strobe_lut : label is "8"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART9_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Synchronise input serial data to system clock + + sync_reg: FD + port map ( D => serial_in, + Q => sync_serial, + C => clk); + + stop_reg: FD + port map ( D => sync_serial, + Q => stop_bit, + C => clk); + + + -- Data delays to capture data at 16 times baud rate + -- Each SRL16E is followed by a flip-flop for best timing + + data_loop: for i in 0 to 8 generate + begin + + lsbs: if i<8 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(i+1), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate lsbs; + + msb: if i=8 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => stop_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate msb; + + data_reg: FDE + port map ( D => data_delay(i), + Q => data_int(i), + CE => en_16_x_baud, + C => clk); + + end generate data_loop; + + -- Assign internal signals to outputs + + data_out <= data_int; + + -- Data delays to capture start bit at 16 time baud rate + + start_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(0), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => start_delay ); + + start_reg: FDE + port map ( D => start_delay, + Q => start_bit, + CE => en_16_x_baud, + C => clk); + + + -- Data delays to capture start bit leading edge at 16 time baud rate + -- Delay ensures data is captured at mid-bit position + + edge_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => start_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '0', + Q => edge_delay ); + + edge_reg: FDE + port map ( D => edge_delay, + Q => start_edge, + CE => en_16_x_baud, + C => clk); + + -- Detect a valid character + + valid_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0040") + --synthesis translate_on + port map( I0 => purge, + I1 => stop_bit, + I2 => start_edge, + I3 => edge_delay, + O => decode_valid_char ); + + valid_reg: FDE + port map ( D => decode_valid_char, + Q => valid_char, + CE => en_16_x_baud, + C => clk); + + -- Purge of data status + + purge_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"54") + --synthesis translate_on + port map( I0 => valid_reg_delay(9), + I1 => valid_char, + I2 => purge, + O => decode_purge ); + + purge_reg: FDE + port map ( D => decode_purge, + Q => purge, + CE => en_16_x_baud, + C => clk); + + -- Delay of valid_char pulse of length equivalent to the time taken + -- to purge data shift register of all data which has been used. + -- Requires 10x16 + 8 delays which is achieved by packing of SRL16E with + -- up to 16 delays and utilising the dedicated flip flop in each stage. + + valid_loop: for i in 0 to 9 generate + begin + + lsb: if i=0 generate + -- + attribute INIT : string; + attribute INIT of delay14_srl : label is "0000"; + -- + begin + + delay14_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_char, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate lsb; + + msbs: if i>0 generate + -- + attribute INIT : string; + attribute INIT of delay16_srl : label is "0000"; + -- + begin + + delay16_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_reg_delay(i-1), + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '1', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate msbs; + + data_reg: FDE + port map ( D => valid_srl_delay(i), + Q => valid_reg_delay(i), + CE => en_16_x_baud, + C => clk); + + end generate valid_loop; + + -- Form data strobe + + strobe_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => valid_char, + I1 => en_16_x_baud, + O => decode_data_strobe ); + + strobe_reg: FD + port map ( D => decode_data_strobe, + Q => data_strobe, + C => clk); + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART9_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/kcuart9_tx.vhd b/projects/PicoBlaze/ise/VHDL/kcuart9_tx.vhd new file mode 100644 index 0000000..0726bf8 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/kcuart9_tx.vhd @@ -0,0 +1,433 @@ +-- Constant (K) Compact UART Transmitter +-- +-- 9-Bit UART Transmitter +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be computed externally and provided as data_in(8). +-- +-- NOTE : This macro is intended to be attached to bbfifo_16x9 and operation requires the +-- interaction of signals to and from that FIFO buffer to work correctly. +-- +-- Version : 1.00 (derived from kcuart_tx version 1.10) +-- Version Date : 10th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART9_TX +-- +entity kcuart9_tx is + Port ( data_in : in std_logic_vector(8 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + tx_complete : out std_logic; + clk : in std_logic); + end kcuart9_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART9_TX +-- +architecture low_level_definition of kcuart9_tx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART9_TX +-- +------------------------------------------------------------------------------------ +-- +signal data_01 : std_logic; +signal data_23 : std_logic; +signal data_45 : std_logic; +signal data_67 : std_logic; +signal data_0123 : std_logic; +signal data_4567 : std_logic; +signal data_01234567 : std_logic; +signal data_01234567_reg : std_logic; + +signal data8_buf : std_logic; +signal force_serial : std_logic; +signal next_serial : std_logic; + +signal bit_count : std_logic_vector(2 downto 0); +signal next_bit_count : std_logic_vector(2 downto 0); +signal half_bit_count : std_logic_vector(2 downto 0); +signal bit_count_cy : std_logic_vector(1 downto 0); + +signal baud_count : std_logic_vector(3 downto 0); +signal next_baud_count : std_logic_vector(3 downto 0); +signal half_baud_count : std_logic_vector(3 downto 0); +signal baud_count_cy : std_logic_vector(3 downto 0); +signal tx_bit_en : std_logic; + +signal decode7 : std_logic; +signal sel_last_bit : std_logic; +signal parity_bit : std_logic; +signal next_transmit : std_logic; +signal transmit : std_logic; +signal next_tx_complete : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of mux1_lut : label is "E4"; +attribute INIT of mux2_lut : label is "E4"; +attribute INIT of mux3_lut : label is "E4"; +attribute INIT of mux4_lut : label is "E4"; + +attribute INIT of buf_data8 : label is "2"; +attribute INIT of force_lut : label is "E0FF"; + +attribute INIT of count7_lut : label is "80"; +attribute INIT of transmit_lut : label is "32"; +attribute INIT of complete_lut : label is "8"; + +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART9_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + mux1_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(0), + I2 => data_in(1), + O => data_01 ); + + mux2_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(2), + I2 => data_in(3), + O => data_23 ); + + mux3_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(4), + I2 => data_in(5), + O => data_45 ); + + mux4_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(6), + I2 => data_in(7), + O => data_67 ); + + + mux5_muxf5: MUXF5 + port map( I1 => data_23, + I0 => data_01, + S => bit_count(1), + O => data_0123 ); + + mux6_muxf5: MUXF5 + port map( I1 => data_67, + I0 => data_45, + S => bit_count(1), + O => data_4567 ); + + mux7_muxf6: MUXF6 + port map( I1 => data_4567, + I0 => data_0123, + S => bit_count(2), + O => data_01234567 ); + + pipeline_mux: FD + port map ( D => data_01234567, + Q => data_01234567_reg, + C => clk); + + -- Serial output logic + + buf_data8: LUT1 + --synthesis translate_off + generic map (INIT => X"2") + --synthesis translate_on + port map( I0 => data_in(8), + O => data8_buf ); + + force_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E0FF") + --synthesis translate_on + port map( I0 => data_01234567_reg, + I1 => parity_bit, + I2 => transmit, + I3 => send_character, + O => force_serial ); + + + mux8_muxf5: MUXF5 + port map( I1 => data8_buf, + I0 => force_serial, + S => sel_last_bit, + O => next_serial ); + + -- Final output flip-flop initialised to start at '1' + high_start: for i in 1 to 1 generate + -- + attribute INIT : bit; + attribute INIT of output_reg : label is '1'; + -- + begin + + output_reg: FDE + --synthesis translate_off + generic map (INIT => '1') + --synthesis translate_on + port map ( D => next_serial, + Q => serial_out, + CE => tx_bit_en, + C => clk); + + end generate high_start; + + + -- bit counter + + bit_count_loop: for i in 0 to 2 generate + -- + attribute INIT : string; + attribute INIT of bit_count_lut : label is "B"; + -- + begin + + bit_reg: FDE + port map ( D => next_bit_count(i), + Q => bit_count(i), + CE => tx_bit_en, + C => clk); + + bit_count_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"B") + --synthesis translate_on + port map( I0 => bit_count(i), + I1 => transmit, + O => half_bit_count(i)); + + lsb_bit_count: if i=0 generate + begin + + bit_count_xor: XORCY + port map( LI => half_bit_count(i), + CI => '1', + O => next_bit_count(i)); + + bit_count_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => half_bit_count(i), + O => bit_count_cy(i)); + + end generate lsb_bit_count; + + upper_bit_count: if i>0 generate + begin + + bit_count_xor: XORCY + port map( LI => half_bit_count(i), + CI => bit_count_cy(i-1), + O => next_bit_count(i)); + + middle_bit_count: if i=1 generate + begin + + bit_count_muxcy: MUXCY + port map( DI => '0', + CI => bit_count_cy(i-1), + S => half_bit_count(i), + O => bit_count_cy(i)); + + end generate middle_bit_count; + + end generate upper_bit_count; + + end generate bit_count_loop; + + + -- baud counter + + baud_count_loop: for i in 0 to 3 generate + -- + attribute INIT : string; + attribute INIT of baud_count_lut : label is "2"; + -- + begin + + baud_reg: FDE + port map ( D => next_baud_count(i), + Q => baud_count(i), + CE => en_16_x_baud, + C => clk); + + baud_count_lut: LUT1 + --synthesis translate_off + generic map (INIT => X"2") + --synthesis translate_on + port map( I0 => baud_count(i), + O => half_baud_count(i)); + + lsb_baud_count: if i=0 generate + begin + + baud_count_xor: XORCY + port map( LI => half_baud_count(i), + CI => en_16_x_baud, + O => next_baud_count(i)); + + baud_count_muxcy: MUXCY + port map( DI => '0', + CI => en_16_x_baud, + S => half_baud_count(i), + O => baud_count_cy(i)); + + end generate lsb_baud_count; + + upper_baud_count: if i>0 generate + begin + + baud_count_xor: XORCY + port map( LI => half_baud_count(i), + CI => baud_count_cy(i-1), + O => next_baud_count(i)); + + baud_count_muxcy: MUXCY + port map( DI => '0', + CI => baud_count_cy(i-1), + S => half_baud_count(i), + O => baud_count_cy(i)); + + end generate upper_baud_count; + + end generate baud_count_loop; + + bit_en_reg: FD + port map ( D => baud_count_cy(3), + Q => tx_bit_en, + C => clk); + + -- state machine + + count7_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"80") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => bit_count(1), + I2 => bit_count(2), + O => decode7 ); + + sel_last_reg: FDE + port map ( D => decode7, + Q => sel_last_bit, + CE => tx_bit_en, + C => clk); + + parity_reg: FDE + port map ( D => sel_last_bit, + Q => parity_bit, + CE => tx_bit_en, + C => clk); + + transmit_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"32") + --synthesis translate_on + port map( I0 => send_character, + I1 => parity_bit, + I2 => transmit, + O => next_transmit ); + + transmit_reg: FDE + port map ( D => next_transmit, + Q => transmit, + CE => tx_bit_en, + C => clk); + + complete_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => parity_bit, + I1 => tx_bit_en, + O => next_tx_complete ); + + complete_reg: FD + port map ( D => next_tx_complete, + Q => tx_complete, + C => clk); + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART9_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/kcuart_rx.vhd b/projects/PicoBlaze/ise/VHDL/kcuart_rx.vhd new file mode 100644 index 0000000..7c22540 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/kcuart_rx.vhd @@ -0,0 +1,352 @@ +-- Constant (K) Compact UART Receiver +-- +-- Version : 1.10 +-- Version Date : 3rd December 2003 +-- Reason : '--translate' directives changed to '--synthesis translate' directives +-- +-- Version : 1.00 +-- Version Date : 16th October 2002 +-- +-- Start of design entry : 16th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART_RX +-- +entity kcuart_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end kcuart_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART_RX +-- +architecture low_level_definition of kcuart_rx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART_RX +-- +------------------------------------------------------------------------------------ +-- +signal sync_serial : std_logic; +signal stop_bit : std_logic; +signal data_int : std_logic_vector(7 downto 0); +signal data_delay : std_logic_vector(7 downto 0); +signal start_delay : std_logic; +signal start_bit : std_logic; +signal edge_delay : std_logic; +signal start_edge : std_logic; +signal decode_valid_char : std_logic; +signal valid_char : std_logic; +signal decode_purge : std_logic; +signal purge : std_logic; +signal valid_srl_delay : std_logic_vector(8 downto 0); +signal valid_reg_delay : std_logic_vector(8 downto 0); +signal decode_data_strobe : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of start_srl : label is "0000"; +attribute INIT of edge_srl : label is "0000"; +attribute INIT of valid_lut : label is "0040"; +attribute INIT of purge_lut : label is "54"; +attribute INIT of strobe_lut : label is "8"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Synchronise input serial data to system clock + + sync_reg: FD + port map ( D => serial_in, + Q => sync_serial, + C => clk); + + stop_reg: FD + port map ( D => sync_serial, + Q => stop_bit, + C => clk); + + + -- Data delays to capture data at 16 time baud rate + -- Each SRL16E is followed by a flip-flop for best timing + + data_loop: for i in 0 to 7 generate + begin + + lsbs: if i<7 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(i+1), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate lsbs; + + msb: if i=7 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => stop_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate msb; + + data_reg: FDE + port map ( D => data_delay(i), + Q => data_int(i), + CE => en_16_x_baud, + C => clk); + + end generate data_loop; + + -- Assign internal signals to outputs + + data_out <= data_int; + + -- Data delays to capture start bit at 16 time baud rate + + start_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(0), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => start_delay ); + + start_reg: FDE + port map ( D => start_delay, + Q => start_bit, + CE => en_16_x_baud, + C => clk); + + + -- Data delays to capture start bit leading edge at 16 time baud rate + -- Delay ensures data is captured at mid-bit position + + edge_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => start_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '0', + Q => edge_delay ); + + edge_reg: FDE + port map ( D => edge_delay, + Q => start_edge, + CE => en_16_x_baud, + C => clk); + + -- Detect a valid character + + valid_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0040") + --synthesis translate_on + port map( I0 => purge, + I1 => stop_bit, + I2 => start_edge, + I3 => edge_delay, + O => decode_valid_char ); + + valid_reg: FDE + port map ( D => decode_valid_char, + Q => valid_char, + CE => en_16_x_baud, + C => clk); + + -- Purge of data status + + purge_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"54") + --synthesis translate_on + port map( I0 => valid_reg_delay(8), + I1 => valid_char, + I2 => purge, + O => decode_purge ); + + purge_reg: FDE + port map ( D => decode_purge, + Q => purge, + CE => en_16_x_baud, + C => clk); + + -- Delay of valid_char pulse of length equivalent to the time taken + -- to purge data shift register of all data which has been used. + -- Requires 9x16 + 8 delays which is achieved by packing of SRL16E with + -- up to 16 delays and utilising the dedicated flip flop in each stage. + + valid_loop: for i in 0 to 8 generate + begin + + lsb: if i=0 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_char, + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate lsb; + + msbs: if i>0 generate + -- + attribute INIT : string; + attribute INIT of delay16_srl : label is "0000"; + -- + begin + + delay16_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_reg_delay(i-1), + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '1', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate msbs; + + data_reg: FDE + port map ( D => valid_srl_delay(i), + Q => valid_reg_delay(i), + CE => en_16_x_baud, + C => clk); + + end generate valid_loop; + + -- Form data strobe + + strobe_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => valid_char, + I1 => en_16_x_baud, + O => decode_data_strobe ); + + strobe_reg: FD + port map ( D => decode_data_strobe, + Q => data_strobe, + C => clk); + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/kcuart_tx.vhd b/projects/PicoBlaze/ise/VHDL/kcuart_tx.vhd new file mode 100644 index 0000000..b8fec85 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/kcuart_tx.vhd @@ -0,0 +1,394 @@ +-- Constant (K) Compact UART Transmitter +-- +-- Version : 1.10 +-- Version Date : 3rd December 2003 +-- Reason : '--translate' directives changed to '--synthesis translate' directives +-- +-- Version : 1.00 +-- Version Date : 14th October 2002 +-- +-- Start of design entry : 2nd October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART_TX +-- +entity kcuart_tx is + Port ( data_in : in std_logic_vector(7 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + Tx_complete : out std_logic; + clk : in std_logic); + end kcuart_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART_TX +-- +architecture low_level_definition of kcuart_tx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART_TX +-- +------------------------------------------------------------------------------------ +-- +signal data_01 : std_logic; +signal data_23 : std_logic; +signal data_45 : std_logic; +signal data_67 : std_logic; +signal data_0123 : std_logic; +signal data_4567 : std_logic; +signal data_01234567 : std_logic; +signal bit_select : std_logic_vector(2 downto 0); +signal next_count : std_logic_vector(2 downto 0); +signal mask_count : std_logic_vector(2 downto 0); +signal mask_count_carry : std_logic_vector(2 downto 0); +signal count_carry : std_logic_vector(2 downto 0); +signal ready_to_start : std_logic; +signal decode_Tx_start : std_logic; +signal Tx_start : std_logic; +signal decode_Tx_run : std_logic; +signal Tx_run : std_logic; +signal decode_hot_state : std_logic; +signal hot_state : std_logic; +signal hot_delay : std_logic; +signal Tx_bit : std_logic; +signal decode_Tx_stop : std_logic; +signal Tx_stop : std_logic; +signal decode_Tx_complete : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of mux1_lut : label is "E4FF"; +attribute INIT of mux2_lut : label is "E4FF"; +attribute INIT of mux3_lut : label is "E4FF"; +attribute INIT of mux4_lut : label is "E4FF"; +attribute INIT of ready_lut : label is "10"; +attribute INIT of start_lut : label is "0190"; +attribute INIT of run_lut : label is "1540"; +attribute INIT of hot_state_lut : label is "94"; +attribute INIT of delay14_srl : label is "0000"; +attribute INIT of stop_lut : label is "0180"; +attribute INIT of complete_lut : label is "8"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + mux1_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(0), + I2 => data_in(1), + I3 => Tx_run, + O => data_01 ); + + mux2_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(2), + I2 => data_in(3), + I3 => Tx_run, + O => data_23 ); + + mux3_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(4), + I2 => data_in(5), + I3 => Tx_run, + O => data_45 ); + + mux4_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(6), + I2 => data_in(7), + I3 => Tx_run, + O => data_67 ); + + mux5_muxf5: MUXF5 + port map( I1 => data_23, + I0 => data_01, + S => bit_select(1), + O => data_0123 ); + + mux6_muxf5: MUXF5 + port map( I1 => data_67, + I0 => data_45, + S => bit_select(1), + O => data_4567 ); + + mux7_muxf6: MUXF6 + port map( I1 => data_4567, + I0 => data_0123, + S => bit_select(2), + O => data_01234567 ); + + -- Register serial output and force start and stop bits + + pipeline_serial: FDRS + port map ( D => data_01234567, + Q => serial_out, + R => Tx_start, + S => Tx_stop, + C => clk); + + -- 3-bit counter + -- Counter is clock enabled by en_16_x_baud + -- Counter will be reset when 'Tx_start' is active + -- Counter will increment when Tx_bit is active + -- Tx_run must be active to count + -- count_carry(2) indicates when terminal count (7) is reached and Tx_bit=1 (ie overflow) + + count_width_loop: for i in 0 to 2 generate + -- + attribute INIT : string; + attribute INIT of count_lut : label is "8"; + -- + begin + + register_bit: FDRE + port map ( D => next_count(i), + Q => bit_select(i), + CE => en_16_x_baud, + R => Tx_start, + C => clk); + + count_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => bit_select(i), + I1 => Tx_run, + O => mask_count(i)); + + mask_and: MULT_AND + port map( I0 => bit_select(i), + I1 => Tx_run, + LO => mask_count_carry(i)); + + lsb_count: if i=0 generate + begin + + count_muxcy: MUXCY + port map( DI => mask_count_carry(i), + CI => Tx_bit, + S => mask_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => mask_count(i), + CI => Tx_bit, + O => next_count(i)); + + end generate lsb_count; + + upper_count: if i>0 generate + begin + + count_muxcy: MUXCY + port map( DI => mask_count_carry(i), + CI => count_carry(i-1), + S => mask_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => mask_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate upper_count; + + end generate count_width_loop; + + -- Ready to start decode + + ready_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"10") + --synthesis translate_on + port map( I0 => Tx_run, + I1 => Tx_start, + I2 => send_character, + O => ready_to_start ); + + -- Start bit enable + + start_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0190") + --synthesis translate_on + port map( I0 => Tx_bit, + I1 => Tx_stop, + I2 => ready_to_start, + I3 => Tx_start, + O => decode_Tx_start ); + + Tx_start_reg: FDE + port map ( D => decode_Tx_start, + Q => Tx_start, + CE => en_16_x_baud, + C => clk); + + + -- Run bit enable + + run_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"1540") + --synthesis translate_on + port map( I0 => count_carry(2), + I1 => Tx_bit, + I2 => Tx_start, + I3 => Tx_run, + O => decode_Tx_run ); + + Tx_run_reg: FDE + port map ( D => decode_Tx_run, + Q => Tx_run, + CE => en_16_x_baud, + C => clk); + + -- Bit rate enable + + hot_state_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"94") + --synthesis translate_on + port map( I0 => Tx_stop, + I1 => ready_to_start, + I2 => Tx_bit, + O => decode_hot_state ); + + hot_state_reg: FDE + port map ( D => decode_hot_state, + Q => hot_state, + CE => en_16_x_baud, + C => clk); + + delay14_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => hot_state, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '1', + Q => hot_delay ); + + Tx_bit_reg: FDE + port map ( D => hot_delay, + Q => Tx_bit, + CE => en_16_x_baud, + C => clk); + + -- Stop bit enable + + stop_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0180") + --synthesis translate_on + port map( I0 => Tx_bit, + I1 => Tx_run, + I2 => count_carry(2), + I3 => Tx_stop, + O => decode_Tx_stop ); + + Tx_stop_reg: FDE + port map ( D => decode_Tx_stop, + Q => Tx_stop, + CE => en_16_x_baud, + C => clk); + + -- Tx_complete strobe + + complete_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => count_carry(2), + I1 => en_16_x_baud, + O => decode_Tx_complete ); + + Tx_complete_reg: FD + port map ( D => decode_Tx_complete, + Q => Tx_complete, + C => clk); + + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/test_bench.vhd b/projects/PicoBlaze/ise/VHDL/test_bench.vhd new file mode 100644 index 0000000..2308394 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/test_bench.vhd @@ -0,0 +1,77 @@ +-- Test Bench for kcpsm3_int_test.vhd +-- +-- Ken Chapman - Xilinx Ltd - June 2003 +-- +-- +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; +USE ieee.numeric_std.ALL; + +ENTITY testbench IS +END testbench; + +ARCHITECTURE behavior OF testbench IS + + -- Design to be tested + + COMPONENT kcpsm3_int_test + Port ( counter : out std_logic_vector(7 downto 0); + waveforms : out std_logic_vector(7 downto 0); + interrupt_event : in std_logic; + clk : in std_logic); + END COMPONENT; + +-- signals to connect kcpsm3_int_test + +SIGNAL counter : std_logic_vector(7 downto 0); +SIGNAL waveforms : std_logic_vector(7 downto 0); +SIGNAL interrupt_event : std_logic := '0'; +SIGNAL clk : std_logic := '0'; + +BEGIN + +-- Define the unit under test + + uut: kcpsm3_int_test + port map ( counter => counter, + waveforms => waveforms, + interrupt_event => interrupt_event, + clk => clk); + + +-- Test Bench begins + + -- Nominal 50MHz clock which also defines number of cycles in simulation + test_clock: process + variable max_cycles : integer :=400; + variable cycle_count : integer := 0; + begin + -- Define the clock cycles and the clock cycle counter + while cycle_count < max_cycles loop + clk <= '0'; + wait for 10 ns; + clk <= '1'; + cycle_count := cycle_count + 1; + wait for 10 ns; + + --Now define stimulus relative to a given clock cycle + + case cycle_count is + + when 30 => interrupt_event <= '1'; + + when 67 => interrupt_event <= '1'; + + when 183 => interrupt_event <= '1'; + + when others => interrupt_event <= '0'; -- no interrupt + + end case; + + end loop; + + wait; -- end of simulation. + + end process; + +END; diff --git a/projects/PicoBlaze/ise/VHDL/uart9_rx.vhd b/projects/PicoBlaze/ise/VHDL/uart9_rx.vhd new file mode 100644 index 0000000..4b9e8a5 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/uart9_rx.vhd @@ -0,0 +1,148 @@ +-- 9-Bit UART Receiver with integral 16 byte FIFO buffer +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be checked externally and is provided as data_out(8). +-- +-- Version : 1.00 (derived from uart_rx version 1.00) +-- Version Date : 11th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART9_RX +-- +entity uart9_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart9_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART9_RX +-- +architecture macro_level_definition of uart9_rx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART9_RX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART Receiver +-- +component kcuart9_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end component; +-- +-- 'Bucket Brigade' FIFO +-- +component bbfifo_16x9 + Port ( data_in : in std_logic_vector(8 downto 0); + data_out : out std_logic_vector(8 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART9_RX +-- +------------------------------------------------------------------------------------ +-- +signal uart_data_out : std_logic_vector(8 downto 0); +signal fifo_write : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART9_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Constant (K) Compact UART 9-bit Receiver + + receiver: kcuart9_rx + port map ( serial_in => serial_in, + data_out => uart_data_out, + data_strobe => fifo_write, + en_16_x_baud => en_16_x_baud, + clk => clk ); + + -- 9-bit 'Bucket Brigade' FIFO + + buf: bbfifo_16x9 + port map ( data_in => uart_data_out, + data_out => data_out, + reset => reset_buffer, + write => fifo_write, + read => read_buffer, + full => buffer_full, + half_full => buffer_half_full, + data_present => buffer_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART9_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/uart9_tx.vhd b/projects/PicoBlaze/ise/VHDL/uart9_tx.vhd new file mode 100644 index 0000000..9f2d3be --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/uart9_tx.vhd @@ -0,0 +1,150 @@ +-- 9-Bit UART Transmitter with integral 16 byte FIFO buffer +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be computed externally and provided as data_in(8). +-- +-- Version : 1.00 (derived from uart_tx version 1.00) +-- Version Date : 10th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART9_TX +-- +entity uart9_tx is + Port ( data_in : in std_logic_vector(8 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart9_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART_TX +-- +architecture macro_level_definition of uart9_tx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART9_TX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART 9-bit Transmitter +-- +component kcuart9_tx + Port ( data_in : in std_logic_vector(8 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + tx_complete : out std_logic; + clk : in std_logic); + end component; +-- +-- 9-bit 'Bucket Brigade' FIFO +-- +component bbfifo_16x9 + Port ( data_in : in std_logic_vector(8 downto 0); + data_out : out std_logic_vector(8 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART9_TX +-- +------------------------------------------------------------------------------------ +-- +signal fifo_data_out : std_logic_vector(8 downto 0); +signal fifo_data_present : std_logic; +signal fifo_read : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Constant (K) Compact UART 9-bit Transmitter + + transmitter: kcuart9_tx + port map ( data_in => fifo_data_out, + send_character => fifo_data_present, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + Tx_complete => fifo_read, + clk => clk); + + -- 9-bit 'Bucket Brigade' FIFO + + buf: bbfifo_16x9 + port map ( data_in => data_in, + data_out => fifo_data_out, + reset => reset_buffer, + write => write_buffer, + read => fifo_read, + full => buffer_full, + half_full => buffer_half_full, + data_present => fifo_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/uart_clock.vhd b/projects/PicoBlaze/ise/VHDL/uart_clock.vhd new file mode 100644 index 0000000..edd2907 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/uart_clock.vhd @@ -0,0 +1,352 @@ +-- +-- KCPSM3 reference design - Real Time Clock with UART communications +-- +-- Ken Chapman - Xilinx Ltd - October 2003 +-- +-- The design demonstrates the following:- +-- Connection of KCPSM3 to Program ROM +-- Connection of UART macros supplied with PicoBlaze with +-- Baud rate generation +-- Definition of input and output ports with +-- Minimum decoding +-- Pipelining where appropriate +-- Interrupt circuit with +-- Simple fixed period timer +-- Automatic clearing using interrupt acknowledge from KCPSM3 +-- +-- The design is set up for a 55MHz system clock and UART communications rate of 38400 baud. +-- Please read design documentation to modify to your own requirements. +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2003. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Furthermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +------------------------------------------------------------------------------------ +-- +-- +entity uart_clock is + Port ( tx : out std_logic; + rx : in std_logic; + alarm : out std_logic; + clk : in std_logic); + end uart_clock; +-- +------------------------------------------------------------------------------------ +-- +-- Start of test architecture +-- +architecture Behavioral of uart_clock is +-- +------------------------------------------------------------------------------------ +-- +-- declaration of KCPSM3 +-- + component kcpsm3 + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end component; +-- +-- declaration of program ROM +-- + component uclock + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end component; +-- +-- declaration of UART transmitter with integral 16 byte FIFO buffer +-- + component uart_tx + Port ( data_in : in std_logic_vector(7 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; +-- +-- declaration of UART Receiver with integral 16 byte FIFO buffer +-- + component uart_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used to connect KCPSM3 to program ROM and I/O logic +-- +signal address : std_logic_vector(9 downto 0); +signal instruction : std_logic_vector(17 downto 0); +signal port_id : std_logic_vector(7 downto 0); +signal out_port : std_logic_vector(7 downto 0); +signal in_port : std_logic_vector(7 downto 0); +signal write_strobe : std_logic; +signal read_strobe : std_logic; +signal interrupt : std_logic; +signal interrupt_ack : std_logic; +-- +-- Signals for connection of peripherals +-- +signal uart_status_port : std_logic_vector(7 downto 0); +-- +-- Signals to form an timer generating an interrupt every microsecond +-- +signal timer_count : integer range 0 to 63 :=0; +signal timer_pulse : std_logic; +-- +-- Signals for UART connections +-- +signal baud_count : integer range 0 to 255 :=0; +signal en_16_x_baud : std_logic; +signal write_to_uart : std_logic; +signal tx_full : std_logic; +signal tx_half_full : std_logic; +signal read_from_uart : std_logic; +signal rx_data : std_logic_vector(7 downto 0); +signal rx_data_present : std_logic; +signal rx_full : std_logic; +signal rx_half_full : std_logic; +-- +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- +-- Start of circuit description +-- +begin + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- KCPSM3 and the program memory + ---------------------------------------------------------------------------------------------------------------------------------- + -- + + processor: kcpsm3 + port map( address => address, + instruction => instruction, + port_id => port_id, + write_strobe => write_strobe, + out_port => out_port, + read_strobe => read_strobe, + in_port => in_port, + interrupt => interrupt, + interrupt_ack => interrupt_ack, + reset => '0', + clk => clk); + + program_rom: uclock + port map( address => address, + instruction => instruction, + clk => clk); + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- Interrupt + ---------------------------------------------------------------------------------------------------------------------------------- + -- + -- + -- Interrupt is a generated once every 55 clock cycles to provide a 1us reference. + -- Interrupt is automatically cleared by interrupt acknowledgment from KCPSM3. + -- + + Timer: process(clk) + begin + + if clk'event and clk='1' then + + if timer_count=54 then + timer_count <= 0; + timer_pulse <= '1'; + else + timer_count <= timer_count + 1; + timer_pulse <= '0'; + end if; + + if interrupt_ack = '1' then + interrupt <= '0'; + elsif timer_pulse = '1' then + interrupt <= '1'; + else + interrupt <= interrupt; + end if; + + end if; + + end process Timer; + + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- KCPSM3 input ports + ---------------------------------------------------------------------------------------------------------------------------------- + -- + -- + -- UART FIFO status signals to form a bus + -- + + uart_status_port <= "000" & rx_data_present & rx_full & rx_half_full & tx_full & tx_half_full ; + + -- + -- The inputs connect via a pipelined multiplexer + -- + + input_ports: process(clk) + begin + if clk'event and clk='1' then + + case port_id(0) is + + + -- read UART status at address 00 hex + when '0' => in_port <= uart_status_port; + + -- read UART receive data at address 01 hex + when '1' => in_port <= rx_data; + + -- Don't care used for all other addresses to ensure minimum logic implementation + when others => in_port <= "XXXXXXXX"; + + end case; + + -- Form read strobe for UART receiver FIFO buffer. + -- The fact that the read strobe will occur after the actual data is read by + -- the KCPSM3 is acceptable because it is really means 'I have read you'! + + read_from_uart <= read_strobe and port_id(0); + + end if; + + end process input_ports; + + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- KCPSM3 output ports + ---------------------------------------------------------------------------------------------------------------------------------- + -- + + -- adding the output registers to the clock processor + + output_ports: process(clk) + begin + + if clk'event and clk='1' then + if write_strobe='1' then + + -- Alarm register at address 00 hex with data bit0 providing control + + if port_id(0)='0' then + alarm <= out_port(0); + end if; + + end if; + + end if; + + end process output_ports; + + -- + -- write to UART transmitter FIFO buffer at address 01 hex. + -- This is a combinatorial decode because the FIFO is the 'port register'. + -- + + write_to_uart <= write_strobe and port_id(0); + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- UART + ---------------------------------------------------------------------------------------------------------------------------------- + -- + -- Connect the 8-bit, 1 stop-bit, no parity transmit and receive macros. + -- Each contains an embedded 16-byte FIFO buffer. + -- + + transmit: uart_tx + port map ( data_in => out_port, + write_buffer => write_to_uart, + reset_buffer => '0', + en_16_x_baud => en_16_x_baud, + serial_out => tx, + buffer_full => tx_full, + buffer_half_full => tx_half_full, + clk => clk ); + + receive: uart_rx + port map ( serial_in => rx, + data_out => rx_data, + read_buffer => read_from_uart, + reset_buffer => '0', + en_16_x_baud => en_16_x_baud, + buffer_data_present => rx_data_present, + buffer_full => rx_full, + buffer_half_full => rx_half_full, + clk => clk ); + + -- + -- Set baud rate to 38400 for the UART communications + -- Requires en_16_x_baud to be 614400Hz which is a single cycle pulse every 163 cycles at 100MHz + -- + -- NOTE : If the highest value for baud_count exceeds 127 you will need to adjust + -- the range of integers in the signal declaration for baud_count. + -- + + baud_timer: process(clk) + begin + if clk'event and clk='1' then + if baud_count=162 then + baud_count <= 0; + en_16_x_baud <= '1'; + else + baud_count <= baud_count + 1; + en_16_x_baud <= '0'; + end if; + end if; + end process baud_timer; + + ---------------------------------------------------------------------------------------------------------------------------------- + +end Behavioral; + +------------------------------------------------------------------------------------------------------------------------------------ +-- +-- END OF FILE uart_clock.vhd +-- +------------------------------------------------------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/ise/VHDL/uart_rx.vhd b/projects/PicoBlaze/ise/VHDL/uart_rx.vhd new file mode 100644 index 0000000..b1374e6 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/uart_rx.vhd @@ -0,0 +1,146 @@ +-- UART Receiver with integral 16 byte FIFO buffer +-- +-- 8 bit, no parity, 1 stop bit +-- +-- Version : 1.00 +-- Version Date : 16th October 2002 +-- +-- Start of design entry : 16th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART_RX +-- +entity uart_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART_RX +-- +architecture macro_level_definition of uart_rx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART_RX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART Receiver +-- +component kcuart_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end component; +-- +-- 'Bucket Brigade' FIFO +-- +component bbfifo_16x8 + Port ( data_in : in std_logic_vector(7 downto 0); + data_out : out std_logic_vector(7 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART_RX +-- +------------------------------------------------------------------------------------ +-- +signal uart_data_out : std_logic_vector(7 downto 0); +signal fifo_write : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + kcuart: kcuart_rx + port map ( serial_in => serial_in, + data_out => uart_data_out, + data_strobe => fifo_write, + en_16_x_baud => en_16_x_baud, + clk => clk ); + + + buf: bbfifo_16x8 + port map ( data_in => uart_data_out, + data_out => data_out, + reset => reset_buffer, + write => fifo_write, + read => read_buffer, + full => buffer_full, + half_full => buffer_half_full, + data_present => buffer_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/VHDL/uart_tx.vhd b/projects/PicoBlaze/ise/VHDL/uart_tx.vhd new file mode 100644 index 0000000..4018c92 --- /dev/null +++ b/projects/PicoBlaze/ise/VHDL/uart_tx.vhd @@ -0,0 +1,148 @@ +-- UART Transmitter with integral 16 byte FIFO buffer +-- +-- 8 bit, no parity, 1 stop bit +-- +-- Version : 1.00 +-- Version Date : 14th October 2002 +-- +-- Start of design entry : 14th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART_TX +-- +entity uart_tx is + Port ( data_in : in std_logic_vector(7 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART_TX +-- +architecture macro_level_definition of uart_tx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART_TX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART Transmitter +-- +component kcuart_tx + Port ( data_in : in std_logic_vector(7 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + Tx_complete : out std_logic; + clk : in std_logic); + end component; +-- +-- 'Bucket Brigade' FIFO +-- +component bbfifo_16x8 + Port ( data_in : in std_logic_vector(7 downto 0); + data_out : out std_logic_vector(7 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART_TX +-- +------------------------------------------------------------------------------------ +-- +signal fifo_data_out : std_logic_vector(7 downto 0); +signal fifo_data_present : std_logic; +signal fifo_read : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + kcuart: kcuart_tx + port map ( data_in => fifo_data_out, + send_character => fifo_data_present, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + Tx_complete => fifo_read, + clk => clk); + + + buf: bbfifo_16x8 + port map ( data_in => data_in, + data_out => fifo_data_out, + reset => reset_buffer, + write => write_buffer, + read => fifo_read, + full => buffer_full, + half_full => buffer_half_full, + data_present => fifo_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/ise/project/bitgen.ut b/projects/PicoBlaze/ise/project/bitgen.ut new file mode 100644 index 0000000..b5b2502 --- /dev/null +++ b/projects/PicoBlaze/ise/project/bitgen.ut @@ -0,0 +1,34 @@ + +-w +-g DebugBitstream:No +-g Binary:no +-g CRC:Enable +-g ConfigRate:4 +-g CclkPin:PullUp +-g M0Pin:PullUp +-g M1Pin:PullUp +-g M2Pin:PullUp +-g ProgPin:PullUp +-g DonePin:PullUp +-g InitPin:Pullup +-g CsPin:Pullup +-g DinPin:Pullup +-g BusyPin:Pullup +-g RdWrPin:Pullup +-g TckPin:PullUp +-g TdiPin:PullUp +-g TdoPin:PullUp +-g TmsPin:PullUp +-g UnusedPin:PullNone +-g UserID:0xFFFFFFFF +-g DCMShutDown:Disable +-g DCIUpdateMode:AsRequired +-g StartUpClk:CClk +-g DONE_cycle:4 +-g GTS_cycle:5 +-g GWE_cycle:6 +-g LCK_cycle:NoWait +-g Security:None +-g DonePipe:No +-g DriveDone:No +-g Encrypt:No diff --git a/projects/PicoBlaze/ise/project/embedded_kcpsm3.lso b/projects/PicoBlaze/ise/project/embedded_kcpsm3.lso new file mode 100644 index 0000000..22de730 --- /dev/null +++ b/projects/PicoBlaze/ise/project/embedded_kcpsm3.lso @@ -0,0 +1 @@ +work diff --git a/projects/PicoBlaze/ise/project/embedded_kcpsm3.prj b/projects/PicoBlaze/ise/project/embedded_kcpsm3.prj new file mode 100644 index 0000000..b43c02e --- /dev/null +++ b/projects/PicoBlaze/ise/project/embedded_kcpsm3.prj @@ -0,0 +1,2 @@ +vhdl work "kcpsm3.vhd" +vhdl work "embedded_kcpsm3.vhd" diff --git a/projects/PicoBlaze/ise/project/embedded_kcpsm3.xst b/projects/PicoBlaze/ise/project/embedded_kcpsm3.xst new file mode 100644 index 0000000..25e0d2b --- /dev/null +++ b/projects/PicoBlaze/ise/project/embedded_kcpsm3.xst @@ -0,0 +1,55 @@ +set -tmpdir ./xst/projnav.tmp +set -xsthdpdir ./xst +run +-ifn embedded_kcpsm3.prj +-ifmt mixed +-ofn embedded_kcpsm3 +-ofmt NGC +-p xc4vsx35-10-ff668 +-top embedded_kcpsm3 +-opt_mode Speed +-opt_level 1 +-iuc NO +-lso embedded_kcpsm3.lso +-keep_hierarchy NO +-rtlview Yes +-glob_opt AllClockNets +-read_cores YES +-write_timing_constraints NO +-cross_clock_analysis NO +-hierarchy_separator / +-bus_delimiter <> +-case maintain +-slice_utilization_ratio 100 +-dsp_utilization_ratio 100 +-verilog2001 YES +-fsm_extract YES -fsm_encoding Auto +-safe_implementation No +-fsm_style lut +-ram_extract Yes +-ram_style Auto +-rom_extract Yes +-mux_style Auto +-decoder_extract YES +-priority_extract YES +-shreg_extract YES +-shift_extract YES +-xor_collapse YES +-rom_style Auto +-mux_extract YES +-resource_sharing YES +-use_dsp48 auto +-iobuf YES +-max_fanout 500 +-bufg 32 +-bufr 24 +-register_duplication YES +-register_balancing No +-slice_packing YES +-optimize_primitives NO +-use_clock_enable Auto +-use_sync_set Auto +-use_sync_reset Auto +-iob auto +-equivalent_register_removal YES +-slice_utilization_ratio_maxmargin 5 diff --git a/projects/PicoBlaze/ise/project/kcpsm3_int_test.lso b/projects/PicoBlaze/ise/project/kcpsm3_int_test.lso new file mode 100644 index 0000000..22de730 --- /dev/null +++ b/projects/PicoBlaze/ise/project/kcpsm3_int_test.lso @@ -0,0 +1 @@ +work diff --git a/projects/PicoBlaze/ise/project/kcpsm3_int_test.prj b/projects/PicoBlaze/ise/project/kcpsm3_int_test.prj new file mode 100644 index 0000000..378a3a8 --- /dev/null +++ b/projects/PicoBlaze/ise/project/kcpsm3_int_test.prj @@ -0,0 +1,3 @@ +vhdl work "kcpsm3.vhd" +vhdl work "E:/work/VHDL/XilinxISE/Projects/PicoBlaze/Assembler/INT_TEST.VHD" +vhdl work "kcpsm3_int_test.vhd" diff --git a/projects/PicoBlaze/ise/project/kcpsm3_int_test.xst b/projects/PicoBlaze/ise/project/kcpsm3_int_test.xst new file mode 100644 index 0000000..a62a0c3 --- /dev/null +++ b/projects/PicoBlaze/ise/project/kcpsm3_int_test.xst @@ -0,0 +1,55 @@ +set -tmpdir ./xst/projnav.tmp +set -xsthdpdir ./xst +run +-ifn kcpsm3_int_test.prj +-ifmt mixed +-ofn kcpsm3_int_test +-ofmt NGC +-p xc4vsx35-10-ff668 +-top kcpsm3_int_test +-opt_mode Speed +-opt_level 1 +-iuc NO +-lso kcpsm3_int_test.lso +-keep_hierarchy NO +-rtlview Yes +-glob_opt AllClockNets +-read_cores YES +-write_timing_constraints NO +-cross_clock_analysis NO +-hierarchy_separator / +-bus_delimiter <> +-case maintain +-slice_utilization_ratio 100 +-dsp_utilization_ratio 100 +-verilog2001 YES +-fsm_extract YES -fsm_encoding Auto +-safe_implementation No +-fsm_style lut +-ram_extract Yes +-ram_style Auto +-rom_extract Yes +-mux_style Auto +-decoder_extract YES +-priority_extract YES +-shreg_extract YES +-shift_extract YES +-xor_collapse YES +-rom_style Auto +-mux_extract YES +-resource_sharing YES +-use_dsp48 auto +-iobuf YES +-max_fanout 500 +-bufg 32 +-bufr 24 +-register_duplication YES +-register_balancing No +-slice_packing YES +-optimize_primitives NO +-use_clock_enable Auto +-use_sync_set Auto +-use_sync_reset Auto +-iob auto +-equivalent_register_removal YES +-slice_utilization_ratio_maxmargin 5 diff --git a/projects/PicoBlaze/ise/project/system.ucf b/projects/PicoBlaze/ise/project/system.ucf new file mode 100644 index 0000000..b22962c --- /dev/null +++ b/projects/PicoBlaze/ise/project/system.ucf @@ -0,0 +1,40 @@ +# +# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" +# SOLELY FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR +# XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION +# AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION +# OR STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS +# IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, +# AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE +# FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY +# WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE +# IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR +# REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF +# INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +# (c) Copyright 2005 Xilinx, Inc. +# All rights reserved. +# + +# Bus clock nets +NET sys_clk_in TNM_NET = "sys_clk_in"; +TIMESPEC "TSSYSCLK" = PERIOD "sys_clk_in" 9.9 ns HIGH 50 %; + +NET sys_clk_in LOC = AE14; +NET sys_clk_in IOSTANDARD = LVCMOS33; +NET sys_rst_in LOC = D6; +NET sys_rst_in PULLUP; +NET sys_rst_in TIG; + +NET sys_rx LOC = W2; +NET sys_rx IOSTANDARD = LVCMOS33; +NET sys_rx TIG; +NET sys_tx LOC = W1; +NET sys_tx IOSTANDARD = LVCMOS33; +NET sys_tx TIG; + +NET sys_alarm LOC = G5; #GPLED0 +NET sys_alarm TIG; +NET sys_alarm SLEW = SLOW; +NET sys_alarm DRIVE = 2; diff --git a/projects/PicoBlaze/ise/project/testbench.fdo b/projects/PicoBlaze/ise/project/testbench.fdo new file mode 100644 index 0000000..f8e75bb --- /dev/null +++ b/projects/PicoBlaze/ise/project/testbench.fdo @@ -0,0 +1,15 @@ +## NOTE: Do not edit this file. +## Autogenerated by ProjNav (creatfdo.tcl) on Sat Oct 01 18:35:41 Westeuropäische Sommerzeit 2005 +## +vlib work +vcom -93 -explicit kcpsm3.vhd +vcom -93 -explicit ./Assembler/INT_TEST.VHD +vcom -93 -explicit kcpsm3_int_test.vhd +vcom -93 -explicit test_bench.vhd +vsim -t 1ps -lib work testbench +do {testbench.udo} +view wave +add wave * +view structure +view signals +run 1000ns diff --git a/projects/PicoBlaze/ise/project/testbench.tdo b/projects/PicoBlaze/ise/project/testbench.tdo new file mode 100644 index 0000000..b756aa2 --- /dev/null +++ b/projects/PicoBlaze/ise/project/testbench.tdo @@ -0,0 +1,15 @@ +## NOTE: Do not edit this file. +## Auto generated by Project Navigator for Post-PAR Simulation +## +vlib work +## Compile Post-PAR Model +vcom -explicit -93 "E:/work/VHDL/XilinxISE/Projects/PicoBlaze/netgen/par/kcpsm3_int_test_timesim.vhd" +vcom -explicit -93 "test_bench.vhd" +vsim -t 1ps -sdfmax /UUT=E:/work/VHDL/XilinxISE/Projects/PicoBlaze/netgen/par/kcpsm3_int_test_timesim.sdf -lib work testbench +do {testbench.udo} +view wave +add wave * +view structure +view signals +run 10us +## End diff --git a/projects/PicoBlaze/ise/project/testbench.udo b/projects/PicoBlaze/ise/project/testbench.udo new file mode 100644 index 0000000..0f04394 --- /dev/null +++ b/projects/PicoBlaze/ise/project/testbench.udo @@ -0,0 +1,4 @@ +-- ProjNav VHDL simulation template: testbench.udo +-- You may edit this file after the line that starts with +-- '-- START' to customize your simulation +-- START user-defined simulation commands diff --git a/projects/PicoBlaze/ise/project/uart_clock.lso b/projects/PicoBlaze/ise/project/uart_clock.lso new file mode 100644 index 0000000..22de730 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_clock.lso @@ -0,0 +1 @@ +work diff --git a/projects/PicoBlaze/ise/project/uart_clock.prj b/projects/PicoBlaze/ise/project/uart_clock.prj new file mode 100644 index 0000000..520c514 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_clock.prj @@ -0,0 +1,8 @@ +vhdl work "kcuart_tx.vhd" +vhdl work "kcuart_rx.vhd" +vhdl work "bbfifo_16x8.vhd" +vhdl work "uart_tx.vhd" +vhdl work "uart_rx.vhd" +vhdl work "kcpsm3.vhd" +vhdl work "E:/work/VHDL/XilinxISE/Projects/PicoBlaze/Assembler/UCLOCK.VHD" +vhdl work "uart_clock.vhd" diff --git a/projects/PicoBlaze/ise/project/uart_clock.ucf b/projects/PicoBlaze/ise/project/uart_clock.ucf new file mode 100644 index 0000000..dc22ab8 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_clock.ucf @@ -0,0 +1,4 @@ +NET "sys_clk_in" TNM_NET = "sys_clk_in"; +TIMESPEC "TS_sys_clk_in" = PERIOD "sys_clk_in" 10 ns HIGH 50 %; +OFFSET = IN 8 ns BEFORE "sys_clk_in" ; +OFFSET = OUT 12 ns AFTER "sys_clk_in" ; diff --git a/projects/PicoBlaze/ise/project/uart_clock.ut b/projects/PicoBlaze/ise/project/uart_clock.ut new file mode 100644 index 0000000..b5b2502 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_clock.ut @@ -0,0 +1,34 @@ + +-w +-g DebugBitstream:No +-g Binary:no +-g CRC:Enable +-g ConfigRate:4 +-g CclkPin:PullUp +-g M0Pin:PullUp +-g M1Pin:PullUp +-g M2Pin:PullUp +-g ProgPin:PullUp +-g DonePin:PullUp +-g InitPin:Pullup +-g CsPin:Pullup +-g DinPin:Pullup +-g BusyPin:Pullup +-g RdWrPin:Pullup +-g TckPin:PullUp +-g TdiPin:PullUp +-g TdoPin:PullUp +-g TmsPin:PullUp +-g UnusedPin:PullNone +-g UserID:0xFFFFFFFF +-g DCMShutDown:Disable +-g DCIUpdateMode:AsRequired +-g StartUpClk:CClk +-g DONE_cycle:4 +-g GTS_cycle:5 +-g GWE_cycle:6 +-g LCK_cycle:NoWait +-g Security:None +-g DonePipe:No +-g DriveDone:No +-g Encrypt:No diff --git a/projects/PicoBlaze/ise/project/uart_clock.xst b/projects/PicoBlaze/ise/project/uart_clock.xst new file mode 100644 index 0000000..18920b9 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_clock.xst @@ -0,0 +1,55 @@ +set -tmpdir ./xst/projnav.tmp +set -xsthdpdir ./xst +run +-ifn uart_clock.prj +-ifmt mixed +-ofn uart_clock +-ofmt NGC +-p xc4vsx35-10-ff668 +-top uart_clock +-opt_mode Speed +-opt_level 1 +-iuc NO +-lso uart_clock.lso +-keep_hierarchy NO +-rtlview Yes +-glob_opt AllClockNets +-read_cores YES +-write_timing_constraints NO +-cross_clock_analysis NO +-hierarchy_separator / +-bus_delimiter <> +-case maintain +-slice_utilization_ratio 100 +-dsp_utilization_ratio 100 +-verilog2001 YES +-fsm_extract YES -fsm_encoding Auto +-safe_implementation No +-fsm_style lut +-ram_extract Yes +-ram_style Auto +-rom_extract Yes +-mux_style Auto +-decoder_extract YES +-priority_extract YES +-shreg_extract YES +-shift_extract YES +-xor_collapse YES +-rom_style Auto +-mux_extract YES +-resource_sharing YES +-use_dsp48 auto +-iobuf YES +-max_fanout 500 +-bufg 32 +-bufr 24 +-register_duplication YES +-register_balancing No +-slice_packing YES +-optimize_primitives NO +-use_clock_enable Auto +-use_sync_set Auto +-use_sync_reset Auto +-iob auto +-equivalent_register_removal YES +-slice_utilization_ratio_maxmargin 5 diff --git a/projects/PicoBlaze/ise/project/uart_rx.lso b/projects/PicoBlaze/ise/project/uart_rx.lso new file mode 100644 index 0000000..22de730 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_rx.lso @@ -0,0 +1 @@ +work diff --git a/projects/PicoBlaze/ise/project/uart_rx.prj b/projects/PicoBlaze/ise/project/uart_rx.prj new file mode 100644 index 0000000..0a7eb00 --- /dev/null +++ b/projects/PicoBlaze/ise/project/uart_rx.prj @@ -0,0 +1,3 @@ +vhdl work "kcuart_rx.vhd" +vhdl work "bbfifo_16x8.vhd" +vhdl work "uart_rx.vhd" diff --git a/projects/PicoBlaze/src/bbfifo_16x8.vhd b/projects/PicoBlaze/src/bbfifo_16x8.vhd new file mode 100644 index 0000000..8ef61e6 --- /dev/null +++ b/projects/PicoBlaze/src/bbfifo_16x8.vhd @@ -0,0 +1,281 @@ +-- 'Bucket Brigade' FIFO +-- 16 deep +-- 8-bit data +-- +-- Version : 1.10 +-- Version Date : 3rd December 2003 +-- Reason : '--translate' directives changed to '--synthesis translate' directives +-- +-- Version : 1.00 +-- Version Date : 14th October 2002 +-- +-- Start of design entry : 14th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for BBFIFO_16x8 +-- +entity bbfifo_16x8 is + Port ( data_in : in std_logic_vector(7 downto 0); + data_out : out std_logic_vector(7 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end bbfifo_16x8; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for BBFIFO_16x8 +-- +architecture low_level_definition of bbfifo_16x8 is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in BBFIFO_16x8 +-- +------------------------------------------------------------------------------------ +-- +signal pointer : std_logic_vector(3 downto 0); +signal next_count : std_logic_vector(3 downto 0); +signal half_count : std_logic_vector(3 downto 0); +signal count_carry : std_logic_vector(2 downto 0); + +signal pointer_zero : std_logic; +signal pointer_full : std_logic; +signal decode_data_present : std_logic; +signal data_present_int : std_logic; +signal valid_write : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of zero_lut : label is "0001"; +attribute INIT of full_lut : label is "8000"; +attribute INIT of dp_lut : label is "BFA0"; +attribute INIT of valid_lut : label is "C4"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of BBFIFO_16x8 circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- SRL16E data storage + + data_width_loop: for i in 0 to 7 generate + -- + attribute INIT : string; + attribute INIT of data_srl : label is "0000"; + -- + begin + + data_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_in(i), + CE => valid_write, + CLK => clk, + A0 => pointer(0), + A1 => pointer(1), + A2 => pointer(2), + A3 => pointer(3), + Q => data_out(i) ); + + end generate data_width_loop; + + -- 4-bit counter to act as data pointer + -- Counter is clock enabled by 'data_present' + -- Counter will be reset when 'reset' is active + -- Counter will increment when 'valid_write' is active + + count_width_loop: for i in 0 to 3 generate + -- + attribute INIT : string; + attribute INIT of count_lut : label is "6606"; + -- + begin + + register_bit: FDRE + port map ( D => next_count(i), + Q => pointer(i), + CE => data_present_int, + R => reset, + C => clk); + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6606") + --synthesis translate_on + port map( I0 => pointer(i), + I1 => read, + I2 => pointer_zero, + I3 => write, + O => half_count(i)); + + lsb_count: if i=0 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => valid_write, + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => valid_write, + O => next_count(i)); + + end generate lsb_count; + + mid_count: if i>0 and i<3 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => count_carry(i-1), + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate mid_count; + + upper_count: if i=3 generate + begin + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate upper_count; + + end generate count_width_loop; + + + -- Detect when pointer is zero and maximum + + zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_zero ); + + + full_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"8000") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_full ); + + + -- Data Present status + + dp_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"BFA0") + --synthesis translate_on + port map( I0 => write, + I1 => read, + I2 => pointer_zero, + I3 => data_present_int, + O => decode_data_present ); + + dp_flop: FDR + port map ( D => decode_data_present, + Q => data_present_int, + R => reset, + C => clk); + + -- Valid write signal + + valid_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"C4") + --synthesis translate_on + port map( I0 => pointer_full, + I1 => write, + I2 => read, + O => valid_write ); + + + -- assign internal signals to outputs + + full <= pointer_full; + half_full <= pointer(3); + data_present <= data_present_int; + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE BBFIFO_16x8.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/bbfifo_16x9.vhd b/projects/PicoBlaze/src/bbfifo_16x9.vhd new file mode 100644 index 0000000..dc57e4d --- /dev/null +++ b/projects/PicoBlaze/src/bbfifo_16x9.vhd @@ -0,0 +1,275 @@ +-- 'Bucket Brigade' FIFO +-- 16 deep +-- 9-bit data +-- +-- Version : 1.00 (derived from bbfifo_16x8 version 1.10) +-- Version Date : 10th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for BBFIFO_16x9 +-- +entity bbfifo_16x9 is + Port ( data_in : in std_logic_vector(8 downto 0); + data_out : out std_logic_vector(8 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end bbfifo_16x9; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for BBFIFO_16x9 +-- +architecture low_level_definition of bbfifo_16x9 is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in BBFIFO_16x9 +-- +------------------------------------------------------------------------------------ +-- +signal pointer : std_logic_vector(3 downto 0); +signal next_count : std_logic_vector(3 downto 0); +signal half_count : std_logic_vector(3 downto 0); +signal count_carry : std_logic_vector(2 downto 0); + +signal pointer_zero : std_logic; +signal pointer_full : std_logic; +signal decode_data_present : std_logic; +signal data_present_int : std_logic; +signal valid_write : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of zero_lut : label is "0001"; +attribute INIT of full_lut : label is "8000"; +attribute INIT of dp_lut : label is "BFA0"; +attribute INIT of valid_lut : label is "C4"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of BBFIFO_16x9 circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- SRL16E data storage + + data_width_loop: for i in 0 to 8 generate + -- + attribute INIT : string; + attribute INIT of data_srl : label is "0000"; + -- + begin + + data_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_in(i), + CE => valid_write, + CLK => clk, + A0 => pointer(0), + A1 => pointer(1), + A2 => pointer(2), + A3 => pointer(3), + Q => data_out(i) ); + + end generate data_width_loop; + + -- 4-bit counter to act as data pointer + -- Counter is clock enabled by 'data_present' + -- Counter will be reset when 'reset' is active + -- Counter will increment when 'valid_write' is active + + count_width_loop: for i in 0 to 3 generate + -- + attribute INIT : string; + attribute INIT of count_lut : label is "6606"; + -- + begin + + register_bit: FDRE + port map ( D => next_count(i), + Q => pointer(i), + CE => data_present_int, + R => reset, + C => clk); + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6606") + --synthesis translate_on + port map( I0 => pointer(i), + I1 => read, + I2 => pointer_zero, + I3 => write, + O => half_count(i)); + + lsb_count: if i=0 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => valid_write, + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => valid_write, + O => next_count(i)); + + end generate lsb_count; + + mid_count: if i>0 and i<3 generate + begin + + count_muxcy: MUXCY + port map( DI => pointer(i), + CI => count_carry(i-1), + S => half_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate mid_count; + + upper_count: if i=3 generate + begin + + count_xor: XORCY + port map( LI => half_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate upper_count; + + end generate count_width_loop; + + + -- Detect when pointer is zero and maximum + + zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_zero ); + + + full_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"8000") + --synthesis translate_on + port map( I0 => pointer(0), + I1 => pointer(1), + I2 => pointer(2), + I3 => pointer(3), + O => pointer_full ); + + + -- Data Present status + + dp_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"BFA0") + --synthesis translate_on + port map( I0 => write, + I1 => read, + I2 => pointer_zero, + I3 => data_present_int, + O => decode_data_present ); + + dp_flop: FDR + port map ( D => decode_data_present, + Q => data_present_int, + R => reset, + C => clk); + + -- Valid write signal + + valid_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"C4") + --synthesis translate_on + port map( I0 => pointer_full, + I1 => write, + I2 => read, + O => valid_write ); + + + -- assign internal signals to outputs + + full <= pointer_full; + half_full <= pointer(3); + data_present <= data_present_int; + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE BBFIFO_16x9.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/embedded_kcpsm3.vhd b/projects/PicoBlaze/src/embedded_kcpsm3.vhd new file mode 100644 index 0000000..1ac4c60 --- /dev/null +++ b/projects/PicoBlaze/src/embedded_kcpsm3.vhd @@ -0,0 +1,106 @@ +-- +-- EMBEDDED_KCPSM3.VHD +-- +-- Ken Chapman - Xilinx Ltd - 3rd June 2003 +-- +-- This file instantiates the KCPSM3 processor macro and connects the +-- program ROM. +-- +-- NOTE: The name of the program ROM will probably need to be changed to +-- reflect the name of the program (PSM) file applied to the assembler. +-- +------------------------------------------------------------------------------------ +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +------------------------------------------------------------------------------------ +-- +-- +entity embedded_kcpsm3 is + Port ( port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + read_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); +end embedded_kcpsm3; +-- +------------------------------------------------------------------------------------ +-- +-- Start of test achitecture +-- +architecture connectivity of embedded_kcpsm3 is +-- +------------------------------------------------------------------------------------ +-- +-- declaration of KCPSM3 +-- + component kcpsm3 + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end component; +-- +-- declaration of program ROM +-- + component prog_rom + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used to connect KCPSM3 to program ROM +-- +signal address : std_logic_vector(9 downto 0); +signal instruction : std_logic_vector(17 downto 0); +-- +------------------------------------------------------------------------------------ +-- +-- Start of test circuit description +-- +begin + + processor: kcpsm3 + port map( address => address, + instruction => instruction, + port_id => port_id, + write_strobe => write_strobe, + out_port => out_port, + read_strobe => read_strobe, + in_port => in_port, + interrupt => interrupt, + interrupt_ack => interrupt_ack, + reset => reset, + clk => clk); + + program: prog_rom + port map( address => address, + instruction => instruction, + clk => clk); + +end connectivity; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE EMBEDDED_KCPSM3.VHD +-- +------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/src/kcpsm3.vhd b/projects/PicoBlaze/src/kcpsm3.vhd new file mode 100644 index 0000000..e1e5804 --- /dev/null +++ b/projects/PicoBlaze/src/kcpsm3.vhd @@ -0,0 +1,1901 @@ +-- PicoBlaze +-- +-- Constant (K) Coded Programmable State Machine for Spartan-3 Devices. +-- Also suitable for use with Virtex-II(PRO) and Virtex-4 devices. +-- +-- Includes additional code for enhanced VHDL simulation. +-- +-- Version : 1.30 +-- Version Date : 14th June 2004 +-- Reasons : Avoid issue caused when ENABLE INTERRUPT is used when interrupts are +-- already enabled when an an interrupt input is applied. +-- Improved design for faster ZERO and CARRY flag logic +-- +-- +-- Previous Version : 1.20 +-- Version Date : 9th July 2003 +-- +-- Start of design entry : 19th May 2003 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +-- Instruction disassembly concept inspired by the work of Prof. Dr.-Ing. Bernhard Lang. +-- University of Applied Sciences, Osnabrueck, Germany. +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2003. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Furthermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Format of this file. +-- +-- This file contains the definition of KCPSM3 as one complete module with sections +-- created using generate loops. This 'flat' approach has been adopted to decrease +-- the time taken to load the module into simulators and the synthesis process. +-- +-- The module defines the implementation of the logic using Xilinx primitives. +-- These ensure predictable synthesis results and maximise the density of the implementation. +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCPSM3 +-- +entity kcpsm3 is + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end kcpsm3; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCPSM3 +-- +architecture low_level_definition of kcpsm3 is +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCPSM3 +-- +------------------------------------------------------------------------------------ +-- +-- Fundamental control and decode signals +-- +signal t_state : std_logic; +signal not_t_state : std_logic; +signal internal_reset : std_logic; +signal reset_delay : std_logic; +signal move_group : std_logic; +signal condition_met : std_logic; +signal normal_count : std_logic; +signal call_type : std_logic; +signal push_or_pop_type : std_logic; +signal valid_to_move : std_logic; +-- +-- Flag signals +-- +signal flag_type : std_logic; +signal flag_write : std_logic; +signal flag_enable : std_logic; +signal zero_flag : std_logic; +signal sel_shadow_zero : std_logic; +signal low_zero : std_logic; +signal high_zero : std_logic; +signal low_zero_carry : std_logic; +signal high_zero_carry : std_logic; +signal zero_carry : std_logic; +signal zero_fast_route : std_logic; +signal low_parity : std_logic; +signal high_parity : std_logic; +signal parity_carry : std_logic; +signal parity : std_logic; +signal carry_flag : std_logic; +signal sel_parity : std_logic; +signal sel_arith_carry : std_logic; +signal sel_shift_carry : std_logic; +signal sel_shadow_carry : std_logic; +signal sel_carry : std_logic_vector(3 downto 0); +signal carry_fast_route : std_logic; +-- +-- Interrupt signals +-- +signal active_interrupt : std_logic; +signal int_pulse : std_logic; +signal clean_int : std_logic; +signal shadow_carry : std_logic; +signal shadow_zero : std_logic; +signal int_enable : std_logic; +signal int_update_enable : std_logic; +signal int_enable_value : std_logic; +signal interrupt_ack_internal : std_logic; +-- +-- Program Counter signals +-- +signal pc : std_logic_vector(9 downto 0); +signal pc_vector : std_logic_vector(9 downto 0); +signal pc_vector_carry : std_logic_vector(8 downto 0); +signal inc_pc_vector : std_logic_vector(9 downto 0); +signal pc_value : std_logic_vector(9 downto 0); +signal pc_value_carry : std_logic_vector(8 downto 0); +signal inc_pc_value : std_logic_vector(9 downto 0); +signal pc_enable : std_logic; +-- +-- Data Register signals +-- +signal sx : std_logic_vector(7 downto 0); +signal sy : std_logic_vector(7 downto 0); +signal register_type : std_logic; +signal register_write : std_logic; +signal register_enable : std_logic; +signal second_operand : std_logic_vector(7 downto 0); +-- +-- Scratch Pad Memory signals +-- +signal memory_data : std_logic_vector(7 downto 0); +signal store_data : std_logic_vector(7 downto 0); +signal memory_type : std_logic; +signal memory_write : std_logic; +signal memory_enable : std_logic; +-- +-- Stack signals +-- +signal stack_pop_data : std_logic_vector(9 downto 0); +signal stack_ram_data : std_logic_vector(9 downto 0); +signal stack_address : std_logic_vector(4 downto 0); +signal half_stack_address : std_logic_vector(4 downto 0); +signal stack_address_carry : std_logic_vector(3 downto 0); +signal next_stack_address : std_logic_vector(4 downto 0); +signal stack_write_enable : std_logic; +signal not_active_interrupt : std_logic; +-- +-- ALU signals +-- +signal logical_result : std_logic_vector(7 downto 0); +signal logical_value : std_logic_vector(7 downto 0); +signal sel_logical : std_logic; +signal shift_result : std_logic_vector(7 downto 0); +signal shift_value : std_logic_vector(7 downto 0); +signal sel_shift : std_logic; +signal high_shift_in : std_logic; +signal low_shift_in : std_logic; +signal shift_in : std_logic; +signal shift_carry : std_logic; +signal shift_carry_value : std_logic; +signal arith_result : std_logic_vector(7 downto 0); +signal arith_value : std_logic_vector(7 downto 0); +signal half_arith : std_logic_vector(7 downto 0); +signal arith_internal_carry : std_logic_vector(7 downto 0); +signal sel_arith_carry_in : std_logic; +signal arith_carry_in : std_logic; +signal invert_arith_carry : std_logic; +signal arith_carry_out : std_logic; +signal sel_arith : std_logic; +signal arith_carry : std_logic; +-- +-- ALU multiplexer signals +-- +signal input_fetch_type : std_logic; +signal sel_group : std_logic; +signal alu_group : std_logic_vector(7 downto 0); +signal input_group : std_logic_vector(7 downto 0); +signal alu_result : std_logic_vector(7 downto 0); +-- +-- read and write strobes +-- +signal io_initial_decode : std_logic; +signal write_active : std_logic; +signal read_active : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation for primitives not +-- contained within generate loops. In each case the information is repeated +-- in the generic map for functional simulation +-- +attribute INIT : string; +attribute INIT of t_state_lut : label is "1"; +attribute INIT of int_pulse_lut : label is "0080"; +attribute INIT of int_update_lut : label is "EAAA"; +attribute INIT of int_value_lut : label is "04"; +attribute INIT of move_group_lut : label is "7400"; +attribute INIT of condition_met_lut : label is "5A3C"; +attribute INIT of normal_count_lut : label is "2F"; +attribute INIT of call_type_lut : label is "1000"; +attribute INIT of push_pop_lut : label is "5400"; +attribute INIT of valid_move_lut : label is "D"; +attribute INIT of flag_type_lut : label is "41FC"; +attribute INIT of flag_enable_lut : label is "8"; +attribute INIT of low_zero_lut : label is "0001"; +attribute INIT of high_zero_lut : label is "0001"; +attribute INIT of sel_shadow_zero_lut : label is "3F"; +attribute INIT of low_parity_lut : label is "6996"; +attribute INIT of high_parity_lut : label is "6996"; +attribute INIT of sel_parity_lut : label is "F3FF"; +attribute INIT of sel_arith_carry_lut : label is "F3"; +attribute INIT of sel_shift_carry_lut : label is "C"; +attribute INIT of sel_shadow_carry_lut : label is "3"; +attribute INIT of register_type_lut : label is "0145"; +attribute INIT of register_enable_lut : label is "8"; +attribute INIT of memory_type_lut : label is "0400"; +attribute INIT of memory_enable_lut : label is "8000"; +attribute INIT of sel_logical_lut : label is "FFE2"; +attribute INIT of low_shift_in_lut : label is "E4"; +attribute INIT of high_shift_in_lut : label is "E4"; +attribute INIT of shift_carry_lut : label is "E4"; +attribute INIT of sel_arith_lut : label is "1F"; +attribute INIT of input_fetch_type_lut : label is "0002"; +attribute INIT of io_decode_lut : label is "0010"; +attribute INIT of write_active_lut : label is "4000"; +attribute INIT of read_active_lut : label is "0100"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCPSM3 circuit description +-- +------------------------------------------------------------------------------------ +-- +begin +-- +------------------------------------------------------------------------------------ +-- +-- Fundamental Control +-- +-- Definition of T-state and internal reset +-- +------------------------------------------------------------------------------------ +-- + t_state_lut: LUT1 + --synthesis translate_off + generic map (INIT => X"1") + --synthesis translate_on + port map( I0 => t_state, + O => not_t_state ); + + toggle_flop: FDR + port map ( D => not_t_state, + Q => t_state, + R => internal_reset, + C => clk); + + reset_flop1: FDS + port map ( D => '0', + Q => reset_delay, + S => reset, + C => clk); + + reset_flop2: FDS + port map ( D => reset_delay, + Q => internal_reset, + S => reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- Interrupt input logic, Interrupt enable and shadow Flags. +-- +-- Captures interrupt input and enables the shadow flags. +-- Decodes instructions which set and reset the interrupt enable flip-flop. +-- +------------------------------------------------------------------------------------ +-- + + -- Interrupt capture + + int_capture_flop: FDR + port map ( D => interrupt, + Q => clean_int, + R => internal_reset, + C => clk); + + int_pulse_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0080") + --synthesis translate_on + port map( I0 => t_state, + I1 => clean_int, + I2 => int_enable, + I3 => active_interrupt, + O => int_pulse ); + + int_flop: FDR + port map ( D => int_pulse, + Q => active_interrupt, + R => internal_reset, + C => clk); + + ack_flop: FD + port map ( D => active_interrupt, + Q => interrupt_ack_internal, + C => clk); + + interrupt_ack <= interrupt_ack_internal; + + -- Shadow flags + + shadow_carry_flop: FDE + port map ( D => carry_flag, + Q => shadow_carry, + CE => active_interrupt, + C => clk); + + shadow_zero_flop: FDE + port map ( D => zero_flag, + Q => shadow_zero, + CE => active_interrupt, + C => clk); + + -- Decode instructions that set or reset interrupt enable + + int_update_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"EAAA") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => int_update_enable ); + + int_value_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"04") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(0), + I2 => interrupt_ack_internal, + O => int_enable_value ); + + int_enable_flop: FDRE + port map ( D => int_enable_value, + Q => int_enable, + CE => int_update_enable, + R => internal_reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- Decodes for the control of the program counter and CALL/RETURN stack +-- +------------------------------------------------------------------------------------ +-- + move_group_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"7400") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => move_group ); + + condition_met_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"5A3C") + --synthesis translate_on + port map( I0 => carry_flag, + I1 => zero_flag, + I2 => instruction(10), + I3 => instruction(11), + O => condition_met ); + + normal_count_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"2F") + --synthesis translate_on + port map( I0 => instruction(12), + I1 => condition_met, + I2 => move_group, + O => normal_count ); + + call_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"1000") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => call_type ); + + push_pop_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"5400") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => push_or_pop_type ); + + valid_move_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"D") + --synthesis translate_on + port map( I0 => instruction(12), + I1 => condition_met, + O => valid_to_move ); +-- +------------------------------------------------------------------------------------ +-- +-- The ZERO and CARRY Flags +-- +------------------------------------------------------------------------------------ +-- + -- Enable for flags + + flag_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"41FC") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => flag_type ); + + flag_write_flop: FD + port map ( D => flag_type, + Q => flag_write, + C => clk); + + flag_enable_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => t_state, + I1 => flag_write, + O => flag_enable ); + + -- Zero Flag + + low_zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => alu_result(0), + I1 => alu_result(1), + I2 => alu_result(2), + I3 => alu_result(3), + O => low_zero ); + + high_zero_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0001") + --synthesis translate_on + port map( I0 => alu_result(4), + I1 => alu_result(5), + I2 => alu_result(6), + I3 => alu_result(7), + O => high_zero ); + + low_zero_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => low_zero, + O => low_zero_carry ); + + high_zero_cymux: MUXCY + port map( DI => '0', + CI => low_zero_carry, + S => high_zero, + O => high_zero_carry ); + + sel_shadow_zero_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"3F") + --synthesis translate_on + port map( I0 => shadow_zero, + I1 => instruction(16), + I2 => instruction(17), + O => sel_shadow_zero ); + + zero_cymux: MUXCY + port map( DI => shadow_zero, + CI => high_zero_carry, + S => sel_shadow_zero, + O => zero_carry ); + + zero_xor: XORCY + port map( LI => '0', + CI => zero_carry, + O => zero_fast_route); + + zero_flag_flop: FDRE + port map ( D => zero_fast_route, + Q => zero_flag, + CE => flag_enable, + R => internal_reset, + C => clk); + + -- Parity detection + + low_parity_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6996") + --synthesis translate_on + port map( I0 => logical_result(0), + I1 => logical_result(1), + I2 => logical_result(2), + I3 => logical_result(3), + O => low_parity ); + + high_parity_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6996") + --synthesis translate_on + port map( I0 => logical_result(4), + I1 => logical_result(5), + I2 => logical_result(6), + I3 => logical_result(7), + O => high_parity ); + + parity_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => low_parity, + O => parity_carry ); + + parity_xor: XORCY + port map( LI => high_parity, + CI => parity_carry, + O => parity); + + -- CARRY flag selection + + sel_parity_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"F3FF") + --synthesis translate_on + port map( I0 => parity, + I1 => instruction(13), + I2 => instruction(15), + I3 => instruction(16), + O => sel_parity ); + + sel_arith_carry_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"F3") + --synthesis translate_on + port map( I0 => arith_carry, + I1 => instruction(16), + I2 => instruction(17), + O => sel_arith_carry ); + + sel_shift_carry_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"C") + --synthesis translate_on + port map( I0 => shift_carry, + I1 => instruction(15), + O => sel_shift_carry ); + + sel_shadow_carry_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"3") + --synthesis translate_on + port map( I0 => shadow_carry, + I1 => instruction(17), + O => sel_shadow_carry ); + + sel_shadow_muxcy: MUXCY + port map( DI => shadow_carry, + CI => '0', + S => sel_shadow_carry, + O => sel_carry(0) ); + + sel_shift_muxcy: MUXCY + port map( DI => shift_carry, + CI => sel_carry(0), + S => sel_shift_carry, + O => sel_carry(1) ); + + sel_arith_muxcy: MUXCY + port map( DI => arith_carry, + CI => sel_carry(1), + S => sel_arith_carry, + O => sel_carry(2) ); + + sel_parity_muxcy: MUXCY + port map( DI => parity, + CI => sel_carry(2), + S => sel_parity, + O => sel_carry(3) ); + + carry_xor: XORCY + port map( LI => '0', + CI => sel_carry(3), + O => carry_fast_route); + + carry_flag_flop: FDRE + port map ( D => carry_fast_route, + Q => carry_flag, + CE => flag_enable, + R => internal_reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- The Program Counter +-- +-- Definition of a 10-bit counter which can be loaded from two sources +-- +------------------------------------------------------------------------------------ +-- + + invert_enable: INV -- Inverter should be implemented in the CE to flip flops + port map( I => t_state, + O => pc_enable); + + pc_loop: for i in 0 to 9 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of vector_select_mux : label is "E4"; + attribute INIT of value_select_mux : label is "E4"; + -- + begin + + vector_select_mux: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(15), + I1 => instruction(i), + I2 => stack_pop_data(i), + O => pc_vector(i) ); + + value_select_mux: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => normal_count, + I1 => inc_pc_vector(i), + I2 => pc(i), + O => pc_value(i) ); + + register_bit: FDRSE + port map ( D => inc_pc_value(i), + Q => pc(i), + R => internal_reset, + S => active_interrupt, + CE => pc_enable, + C => clk); + + pc_lsb_carry: if i=0 generate + begin + + pc_vector_muxcy: MUXCY + port map( DI => '0', + CI => instruction(13), + S => pc_vector(i), + O => pc_vector_carry(i)); + + pc_vector_xor: XORCY + port map( LI => pc_vector(i), + CI => instruction(13), + O => inc_pc_vector(i)); + + pc_value_muxcy: MUXCY + port map( DI => '0', + CI => normal_count, + S => pc_value(i), + O => pc_value_carry(i)); + + pc_value_xor: XORCY + port map( LI => pc_value(i), + CI => normal_count, + O => inc_pc_value(i)); + + end generate pc_lsb_carry; + + pc_mid_carry: if i>0 and i<9 generate + begin + + pc_vector_muxcy: MUXCY + port map( DI => '0', + CI => pc_vector_carry(i-1), + S => pc_vector(i), + O => pc_vector_carry(i)); + + pc_vector_xor: XORCY + port map( LI => pc_vector(i), + CI => pc_vector_carry(i-1), + O => inc_pc_vector(i)); + + pc_value_muxcy: MUXCY + port map( DI => '0', + CI => pc_value_carry(i-1), + S => pc_value(i), + O => pc_value_carry(i)); + + pc_value_xor: XORCY + port map( LI => pc_value(i), + CI => pc_value_carry(i-1), + O => inc_pc_value(i)); + + end generate pc_mid_carry; + + pc_msb_carry: if i=9 generate + begin + + pc_vector_xor: XORCY + port map( LI => pc_vector(i), + CI => pc_vector_carry(i-1), + O => inc_pc_vector(i)); + + pc_value_xor: XORCY + port map( LI => pc_value(i), + CI => pc_value_carry(i-1), + O => inc_pc_value(i)); + + end generate pc_msb_carry; + + end generate pc_loop; + + address <= pc; +-- +------------------------------------------------------------------------------------ +-- +-- Register Bank and second operand selection. +-- +-- Definition of an 8-bit dual port RAM with 16 locations +-- including write enable decode. +-- +-- Outputs are assigned to PORT_ID and OUT_PORT. +-- +------------------------------------------------------------------------------------ +-- + -- Forming decode signal + + register_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0145") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => register_type ); + + register_write_flop: FD + port map ( D => register_type, + Q => register_write, + C => clk); + + register_enable_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => t_state, + I1 => register_write, + O => register_enable ); + + reg_loop: for i in 0 to 7 generate + -- + -- Attribute to define RAM contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of register_bit : label is "0000"; + attribute INIT of operand_select_mux : label is "E4"; + -- + begin + + register_bit: RAM16X1D + --synthesis translate_off + generic map(INIT => X"0000") + --synthesis translate_on + port map ( D => alu_result(i), + WE => register_enable, + WCLK => clk, + A0 => instruction(8), + A1 => instruction(9), + A2 => instruction(10), + A3 => instruction(11), + DPRA0 => instruction(4), + DPRA1 => instruction(5), + DPRA2 => instruction(6), + DPRA3 => instruction(7), + SPO => sx(i), + DPO => sy(i)); + + operand_select_mux: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(12), + I1 => instruction(i), + I2 => sy(i), + O => second_operand(i) ); + + end generate reg_loop; + + out_port <= sx; + port_id <= second_operand; +-- +------------------------------------------------------------------------------------ +-- +-- Store Memory +-- +-- Definition of an 8-bit single port RAM with 64 locations +-- including write enable decode. +-- +------------------------------------------------------------------------------------ +-- + -- Forming decode signal + + memory_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0400") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => memory_type ); + + memory_write_flop: FD + port map ( D => memory_type, + Q => memory_write, + C => clk); + + memory_enable_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"8000") + --synthesis translate_on + port map( I0 => t_state, + I1 => instruction(13), + I2 => instruction(14), + I3 => memory_write, + O => memory_enable ); + + store_loop: for i in 0 to 7 generate + -- + -- Attribute to define RAM contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of memory_bit : label is "0000000000000000"; + -- + begin + + memory_bit: RAM64X1S + --synthesis translate_off + generic map(INIT => X"0000000000000000") + --synthesis translate_on + port map ( D => sx(i), + WE => memory_enable, + WCLK => clk, + A0 => second_operand(0), + A1 => second_operand(1), + A2 => second_operand(2), + A3 => second_operand(3), + A4 => second_operand(4), + A5 => second_operand(5), + O => memory_data(i)); + + store_flop: FD + port map ( D => memory_data(i), + Q => store_data(i), + C => clk); + + end generate store_loop; +-- +------------------------------------------------------------------------------------ +-- +-- Logical operations +-- +-- Definition of AND, OR, XOR and LOAD functions which also provides TEST. +-- Includes pipeline stage used to form ALU multiplexer including decode. +-- +------------------------------------------------------------------------------------ +-- + sel_logical_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"FFE2") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => sel_logical ); + + logical_loop: for i in 0 to 7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of logical_lut : label is "6E8A"; + -- + begin + + logical_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6E8A") + --synthesis translate_on + port map( I0 => second_operand(i), + I1 => sx(i), + I2 => instruction(13), + I3 => instruction(14), + O => logical_value(i)); + + logical_flop: FDR + port map ( D => logical_value(i), + Q => logical_result(i), + R => sel_logical, + C => clk); + + end generate logical_loop; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Shift and Rotate operations +-- +-- Includes pipeline stage used to form ALU multiplexer including decode. +-- +------------------------------------------------------------------------------------ +-- + sel_shift_inv: INV -- Inverter should be implemented in the reset to flip flops + port map( I => instruction(17), + O => sel_shift); + + -- Bit to input to shift register + + high_shift_in_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(1), + I1 => sx(0), + I2 => instruction(0), + O => high_shift_in ); + + low_shift_in_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(1), + I1 => carry_flag, + I2 => sx(7), + O => low_shift_in ); + + shift_in_muxf5: MUXF5 + port map( I1 => high_shift_in, + I0 => low_shift_in, + S => instruction(2), + O => shift_in ); + + -- Forming shift carry signal + + shift_carry_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => sx(7), + I2 => sx(0), + O => shift_carry_value ); + + pipeline_bit: FD + port map ( D => shift_carry_value, + Q => shift_carry, + C => clk); + + shift_loop: for i in 0 to 7 generate + begin + + lsb_shift: if i=0 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of shift_mux_lut : label is "E4"; + -- + begin + + shift_mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => shift_in, + I2 => sx(i+1), + O => shift_value(i) ); + + end generate lsb_shift; + + mid_shift: if i>0 and i<7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of shift_mux_lut : label is "E4"; + -- + begin + + shift_mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => sx(i-1), + I2 => sx(i+1), + O => shift_value(i) ); + + end generate mid_shift; + + msb_shift: if i=7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of shift_mux_lut : label is "E4"; + -- + begin + + shift_mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(3), + I1 => sx(i-1), + I2 => shift_in, + O => shift_value(i) ); + + end generate msb_shift; + + shift_flop: FDR + port map ( D => shift_value(i), + Q => shift_result(i), + R => sel_shift, + C => clk); + + end generate shift_loop; +-- +------------------------------------------------------------------------------------ +-- +-- Arithmetic operations +-- +-- Definition of ADD, ADDCY, SUB and SUBCY functions which also provides COMPARE. +-- Includes pipeline stage used to form ALU multiplexer including decode. +-- +------------------------------------------------------------------------------------ +-- + sel_arith_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"1F") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + O => sel_arith ); + + arith_loop: for i in 0 to 7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of arith_lut : label is "96"; + -- + begin + + lsb_arith: if i=0 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of arith_carry_in_lut : label is "6C"; + -- + begin + + arith_carry_in_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"6C") + --synthesis translate_on + port map( I0 => instruction(13), + I1 => instruction(14), + I2 => carry_flag, + O => sel_arith_carry_in ); + + arith_carry_in_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => sel_arith_carry_in, + O => arith_carry_in); + + arith_muxcy: MUXCY + port map( DI => sx(i), + CI => arith_carry_in, + S => half_arith(i), + O => arith_internal_carry(i)); + + arith_xor: XORCY + port map( LI => half_arith(i), + CI => arith_carry_in, + O => arith_value(i)); + + end generate lsb_arith; + + mid_arith: if i>0 and i<7 generate + begin + + arith_muxcy: MUXCY + port map( DI => sx(i), + CI => arith_internal_carry(i-1), + S => half_arith(i), + O => arith_internal_carry(i)); + + arith_xor: XORCY + port map( LI => half_arith(i), + CI => arith_internal_carry(i-1), + O => arith_value(i)); + + end generate mid_arith; + + msb_arith: if i=7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of arith_carry_out_lut : label is "2"; + -- + begin + + arith_muxcy: MUXCY + port map( DI => sx(i), + CI => arith_internal_carry(i-1), + S => half_arith(i), + O => arith_internal_carry(i)); + + arith_xor: XORCY + port map( LI => half_arith(i), + CI => arith_internal_carry(i-1), + O => arith_value(i)); + + arith_carry_out_lut: LUT1 + --synthesis translate_off + generic map (INIT => X"2") + --synthesis translate_on + port map( I0 => instruction(14), + O => invert_arith_carry ); + + arith_carry_out_xor: XORCY + port map( LI => invert_arith_carry, + CI => arith_internal_carry(i), + O => arith_carry_out); + + arith_carry_flop: FDR + port map ( D => arith_carry_out, + Q => arith_carry, + R => sel_arith, + C => clk); + + end generate msb_arith; + + arith_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"96") + --synthesis translate_on + port map( I0 => sx(i), + I1 => second_operand(i), + I2 => instruction(14), + O => half_arith(i)); + + arith_flop: FDR + port map ( D => arith_value(i), + Q => arith_result(i), + R => sel_arith, + C => clk); + + end generate arith_loop; +-- +-- +------------------------------------------------------------------------------------ +-- +-- ALU multiplexer +-- +------------------------------------------------------------------------------------ +-- + input_fetch_type_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0002") + --synthesis translate_on + port map( I0 => instruction(14), + I1 => instruction(15), + I2 => instruction(16), + I3 => instruction(17), + O => input_fetch_type ); + + sel_group_flop: FD + port map ( D => input_fetch_type, + Q => sel_group, + C => clk); + + alu_mux_loop: for i in 0 to 7 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + attribute INIT : string; + attribute INIT of or_lut : label is "FE"; + attribute INIT of mux_lut : label is "E4"; + -- + begin + + or_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"FE") + --synthesis translate_on + port map( I0 => logical_result(i), + I1 => arith_result(i), + I2 => shift_result(i), + O => alu_group(i)); + + mux_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => instruction(13), + I1 => in_port(i), + I2 => store_data(i), + O => input_group(i)); + + shift_in_muxf5: MUXF5 + port map( I1 => input_group(i), + I0 => alu_group(i), + S => sel_group, + O => alu_result(i) ); + + end generate alu_mux_loop; +-- +------------------------------------------------------------------------------------ +-- +-- Read and Write Strobes +-- +------------------------------------------------------------------------------------ +-- + io_decode_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0010") + --synthesis translate_on + port map( I0 => active_interrupt, + I1 => instruction(13), + I2 => instruction(14), + I3 => instruction(16), + O => io_initial_decode ); + + write_active_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"4000") + --synthesis translate_on + port map( I0 => t_state, + I1 => instruction(15), + I2 => instruction(17), + I3 => io_initial_decode, + O => write_active ); + + write_strobe_flop: FDR + port map ( D => write_active, + Q => write_strobe, + R => internal_reset, + C => clk); + + read_active_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0100") + --synthesis translate_on + port map( I0 => t_state, + I1 => instruction(15), + I2 => instruction(17), + I3 => io_initial_decode, + O => read_active ); + + read_strobe_flop: FDR + port map ( D => read_active, + Q => read_strobe, + R => internal_reset, + C => clk); +-- +------------------------------------------------------------------------------------ +-- +-- Program CALL/RETURN stack +-- +-- Provided the counter and memory for a 32 deep stack supporting nested +-- subroutine calls to a depth of 31 levels. +-- +------------------------------------------------------------------------------------ +-- + -- Stack memory is 32 locations of 10-bit single port. + + stack_ram_inv: INV -- Inverter should be implemented in the WE to RAM + port map( I => t_state, + O => stack_write_enable); + + stack_ram_loop: for i in 0 to 9 generate + -- + -- Attribute to define RAM contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of stack_bit : label is "00000000"; + -- + begin + + stack_bit: RAM32X1S + --synthesis translate_off + generic map(INIT => X"00000000") + --synthesis translate_on + port map ( D => pc(i), + WE => stack_write_enable, + WCLK => clk, + A0 => stack_address(0), + A1 => stack_address(1), + A2 => stack_address(2), + A3 => stack_address(3), + A4 => stack_address(4), + O => stack_ram_data(i)); + + stack_flop: FD + port map ( D => stack_ram_data(i), + Q => stack_pop_data(i), + C => clk); + + end generate stack_ram_loop; + + -- Stack address pointer is a 5-bit counter + + stack_count_inv: INV -- Inverter should be implemented in the CE to the flip-flops + port map( I => active_interrupt, + O => not_active_interrupt); + + stack_count_loop: for i in 0 to 4 generate + begin + + register_bit: FDRE + port map ( D => next_stack_address(i), + Q => stack_address(i), + R => internal_reset, + CE => not_active_interrupt, + C => clk); + + lsb_stack_count: if i=0 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of count_lut : label is "6555"; + -- + begin + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"6555") + --synthesis translate_on + port map( I0 => stack_address(i), + I1 => t_state, + I2 => valid_to_move, + I3 => push_or_pop_type, + O => half_stack_address(i) ); + + count_muxcy: MUXCY + port map( DI => stack_address(i), + CI => '0', + S => half_stack_address(i), + O => stack_address_carry(i)); + + count_xor: XORCY + port map( LI => half_stack_address(i), + CI => '0', + O => next_stack_address(i)); + + end generate lsb_stack_count; + + mid_stack_count: if i>0 and i<4 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of count_lut : label is "A999"; + -- + begin + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"A999") + --synthesis translate_on + port map( I0 => stack_address(i), + I1 => t_state, + I2 => valid_to_move, + I3 => call_type, + O => half_stack_address(i) ); + + count_muxcy: MUXCY + port map( DI => stack_address(i), + CI => stack_address_carry(i-1), + S => half_stack_address(i), + O => stack_address_carry(i)); + + count_xor: XORCY + port map( LI => half_stack_address(i), + CI => stack_address_carry(i-1), + O => next_stack_address(i)); + + end generate mid_stack_count; + + + msb_stack_count: if i=4 generate + -- + -- Attribute to define LUT contents during implementation + -- The information is repeated in the generic map for functional simulation + -- + attribute INIT : string; + attribute INIT of count_lut : label is "A999"; + -- + begin + + count_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"A999") + --synthesis translate_on + port map( I0 => stack_address(i), + I1 => t_state, + I2 => valid_to_move, + I3 => call_type, + O => half_stack_address(i) ); + + count_xor: XORCY + port map( LI => half_stack_address(i), + CI => stack_address_carry(i-1), + O => next_stack_address(i)); + + end generate msb_stack_count; + + end generate stack_count_loop; + +-- +------------------------------------------------------------------------------------ +-- +-- End of description for KCPSM3 macro. +-- +------------------------------------------------------------------------------------ +-- +--********************************************************************************** +-- Code for simulation purposes only after this line +--********************************************************************************** +-- +------------------------------------------------------------------------------------ +-- +-- Code for simulation. +-- +-- Disassemble the instruction codes to form a text string variable for display. +-- Determine status of reset and flags and present in the form of a text string. +-- Provide a local variables to simulate the contents of each register and scratch +-- pad memory location. +-- +------------------------------------------------------------------------------------ +-- + --All of this section is ignored during synthesis. + --synthesis translate off + + simulation: process (clk, instruction) + -- + --complete instruction decode + -- + variable kcpsm3_opcode : string(1 to 19); + -- + --Status of flags and processor + -- + variable kcpsm3_status : string(1 to 13):= "NZ, NC, Reset"; + + -- + --contents of each register + -- + variable s0_contents : std_logic_vector(7 downto 0):=X"00"; + variable s1_contents : std_logic_vector(7 downto 0):=X"00"; + variable s2_contents : std_logic_vector(7 downto 0):=X"00"; + variable s3_contents : std_logic_vector(7 downto 0):=X"00"; + variable s4_contents : std_logic_vector(7 downto 0):=X"00"; + variable s5_contents : std_logic_vector(7 downto 0):=X"00"; + variable s6_contents : std_logic_vector(7 downto 0):=X"00"; + variable s7_contents : std_logic_vector(7 downto 0):=X"00"; + variable s8_contents : std_logic_vector(7 downto 0):=X"00"; + variable s9_contents : std_logic_vector(7 downto 0):=X"00"; + variable sa_contents : std_logic_vector(7 downto 0):=X"00"; + variable sb_contents : std_logic_vector(7 downto 0):=X"00"; + variable sc_contents : std_logic_vector(7 downto 0):=X"00"; + variable sd_contents : std_logic_vector(7 downto 0):=X"00"; + variable se_contents : std_logic_vector(7 downto 0):=X"00"; + variable sf_contents : std_logic_vector(7 downto 0):=X"00"; + -- + --contents of each scratch pad memory location + -- + variable spm00_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm01_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm02_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm03_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm04_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm05_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm06_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm07_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm08_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm09_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm0f_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm10_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm11_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm12_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm13_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm14_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm15_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm16_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm17_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm18_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm19_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm1f_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm20_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm21_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm22_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm23_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm24_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm25_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm26_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm27_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm28_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm29_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm2f_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm30_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm31_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm32_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm33_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm34_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm35_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm36_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm37_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm38_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm39_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3a_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3b_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3c_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3d_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3e_contents : std_logic_vector(7 downto 0):=X"00"; + variable spm3f_contents : std_logic_vector(7 downto 0):=X"00"; + -- + --temporary variables + -- + variable sx_decode : string(1 to 2); --sX register specification + variable sy_decode : string(1 to 2); --sY register specification + variable kk_decode : string(1 to 2); --constant value specification + variable aaa_decode : string(1 to 3); --address specification + -- + -------------------------------------------------------------------------------- + -- + -- Function to convert 4-bit binary nibble to hexadecimal character + -- + -------------------------------------------------------------------------------- + -- + function hexcharacter (nibble: std_logic_vector(3 downto 0)) + return character is + variable hex: character; + begin + case nibble is + when "0000" => hex := '0'; + when "0001" => hex := '1'; + when "0010" => hex := '2'; + when "0011" => hex := '3'; + when "0100" => hex := '4'; + when "0101" => hex := '5'; + when "0110" => hex := '6'; + when "0111" => hex := '7'; + when "1000" => hex := '8'; + when "1001" => hex := '9'; + when "1010" => hex := 'A'; + when "1011" => hex := 'B'; + when "1100" => hex := 'C'; + when "1101" => hex := 'D'; + when "1110" => hex := 'E'; + when "1111" => hex := 'F'; + when others => hex := 'x'; + end case; + return hex; + end hexcharacter; + -- + -------------------------------------------------------------------------------- + -- + begin + + -- decode first register + sx_decode(1) := 's'; + sx_decode(2) := hexcharacter(instruction(11 downto 8)); + + -- decode second register + sy_decode(1) := 's'; + sy_decode(2) := hexcharacter(instruction(7 downto 4)); + + -- decode constant value + kk_decode(1) := hexcharacter(instruction(7 downto 4)); + kk_decode(2) := hexcharacter(instruction(3 downto 0)); + + -- address value + aaa_decode(1) := hexcharacter("00" & instruction(9 downto 8)); + aaa_decode(2) := hexcharacter(instruction(7 downto 4)); + aaa_decode(3) := hexcharacter(instruction(3 downto 0)); + + -- decode instruction + case instruction(17 downto 12) is + when "000000" => kcpsm3_opcode := "LOAD " & sx_decode & ',' & kk_decode & " "; + when "000001" => kcpsm3_opcode := "LOAD " & sx_decode & ',' & sy_decode & " "; + when "001010" => kcpsm3_opcode := "AND " & sx_decode & ',' & kk_decode & " "; + when "001011" => kcpsm3_opcode := "AND " & sx_decode & ',' & sy_decode & " "; + when "001100" => kcpsm3_opcode := "OR " & sx_decode & ',' & kk_decode & " "; + when "001101" => kcpsm3_opcode := "OR " & sx_decode & ',' & sy_decode & " "; + when "001110" => kcpsm3_opcode := "XOR " & sx_decode & ',' & kk_decode & " "; + when "001111" => kcpsm3_opcode := "XOR " & sx_decode & ',' & sy_decode & " "; + when "010010" => kcpsm3_opcode := "TEST " & sx_decode & ',' & kk_decode & " "; + when "010011" => kcpsm3_opcode := "TEST " & sx_decode & ',' & sy_decode & " "; + when "011000" => kcpsm3_opcode := "ADD " & sx_decode & ',' & kk_decode & " "; + when "011001" => kcpsm3_opcode := "ADD " & sx_decode & ',' & sy_decode & " "; + when "011010" => kcpsm3_opcode := "ADDCY " & sx_decode & ',' & kk_decode & " "; + when "011011" => kcpsm3_opcode := "ADDCY " & sx_decode & ',' & sy_decode & " "; + when "011100" => kcpsm3_opcode := "SUB " & sx_decode & ',' & kk_decode & " "; + when "011101" => kcpsm3_opcode := "SUB " & sx_decode & ',' & sy_decode & " "; + when "011110" => kcpsm3_opcode := "SUBCY " & sx_decode & ',' & kk_decode & " "; + when "011111" => kcpsm3_opcode := "SUBCY " & sx_decode & ',' & sy_decode & " "; + when "010100" => kcpsm3_opcode := "COMPARE " & sx_decode & ',' & kk_decode & " "; + when "010101" => kcpsm3_opcode := "COMPARE " & sx_decode & ',' & sy_decode & " "; + when "100000" => + case instruction(3 downto 0) is + when "0110" => kcpsm3_opcode := "SL0 " & sx_decode & " "; + when "0111" => kcpsm3_opcode := "SL1 " & sx_decode & " "; + when "0100" => kcpsm3_opcode := "SLX " & sx_decode & " "; + when "0000" => kcpsm3_opcode := "SLA " & sx_decode & " "; + when "0010" => kcpsm3_opcode := "RL " & sx_decode & " "; + when "1110" => kcpsm3_opcode := "SR0 " & sx_decode & " "; + when "1111" => kcpsm3_opcode := "SR1 " & sx_decode & " "; + when "1010" => kcpsm3_opcode := "SRX " & sx_decode & " "; + when "1000" => kcpsm3_opcode := "SRA " & sx_decode & " "; + when "1100" => kcpsm3_opcode := "RR " & sx_decode & " "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "101100" => kcpsm3_opcode := "OUTPUT " & sx_decode & ',' & kk_decode & " "; + when "101101" => kcpsm3_opcode := "OUTPUT " & sx_decode & ",(" & sy_decode & ") "; + when "000100" => kcpsm3_opcode := "INPUT " & sx_decode & ',' & kk_decode & " "; + when "000101" => kcpsm3_opcode := "INPUT " & sx_decode & ",(" & sy_decode & ") "; + when "101110" => kcpsm3_opcode := "STORE " & sx_decode & ',' & kk_decode & " "; + when "101111" => kcpsm3_opcode := "STORE " & sx_decode & ",(" & sy_decode & ") "; + when "000110" => kcpsm3_opcode := "FETCH " & sx_decode & ',' & kk_decode & " "; + when "000111" => kcpsm3_opcode := "FETCH " & sx_decode & ",(" & sy_decode & ") "; + when "110100" => kcpsm3_opcode := "JUMP " & aaa_decode & " "; + when "110101" => + case instruction(11 downto 10) is + when "00" => kcpsm3_opcode := "JUMP Z," & aaa_decode & " "; + when "01" => kcpsm3_opcode := "JUMP NZ," & aaa_decode & " "; + when "10" => kcpsm3_opcode := "JUMP C," & aaa_decode & " "; + when "11" => kcpsm3_opcode := "JUMP NC," & aaa_decode & " "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "110000" => kcpsm3_opcode := "CALL " & aaa_decode & " "; + when "110001" => + case instruction(11 downto 10) is + when "00" => kcpsm3_opcode := "CALL Z," & aaa_decode & " "; + when "01" => kcpsm3_opcode := "CALL NZ," & aaa_decode & " "; + when "10" => kcpsm3_opcode := "CALL C," & aaa_decode & " "; + when "11" => kcpsm3_opcode := "CALL NC," & aaa_decode & " "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "101010" => kcpsm3_opcode := "RETURN "; + when "101011" => + case instruction(11 downto 10) is + when "00" => kcpsm3_opcode := "RETURN Z "; + when "01" => kcpsm3_opcode := "RETURN NZ "; + when "10" => kcpsm3_opcode := "RETURN C "; + when "11" => kcpsm3_opcode := "RETURN NC "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "111000" => + case instruction(0) is + when '0' => kcpsm3_opcode := "RETURNI DISABLE "; + when '1' => kcpsm3_opcode := "RETURNI ENABLE "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when "111100" => + case instruction(0) is + when '0' => kcpsm3_opcode := "DISABLE INTERRUPT "; + when '1' => kcpsm3_opcode := "ENABLE INTERRUPT "; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + when others => kcpsm3_opcode := "Invalid Instruction"; + end case; + + if clk'event and clk='1' then + + --reset and flag status information + if reset='1' or reset_delay='1' then + kcpsm3_status := "NZ, NC, Reset"; + else + kcpsm3_status(7 to 13) := " "; + if flag_enable='1' then + if zero_carry='1' then + kcpsm3_status(1 to 4) := " Z, "; + else + kcpsm3_status(1 to 4) := "NZ, "; + end if; + if sel_carry(3)='1' then + kcpsm3_status(5 to 6) := " C"; + else + kcpsm3_status(5 to 6) := "NC"; + end if; + end if; + end if; + + --simulation of register contents + if register_enable='1' then + case instruction(11 downto 8) is + when "0000" => s0_contents := alu_result; + when "0001" => s1_contents := alu_result; + when "0010" => s2_contents := alu_result; + when "0011" => s3_contents := alu_result; + when "0100" => s4_contents := alu_result; + when "0101" => s5_contents := alu_result; + when "0110" => s6_contents := alu_result; + when "0111" => s7_contents := alu_result; + when "1000" => s8_contents := alu_result; + when "1001" => s9_contents := alu_result; + when "1010" => sa_contents := alu_result; + when "1011" => sb_contents := alu_result; + when "1100" => sc_contents := alu_result; + when "1101" => sd_contents := alu_result; + when "1110" => se_contents := alu_result; + when "1111" => sf_contents := alu_result; + when others => null; + end case; + end if; + + --simulation of scratch pad memory contents + if memory_enable='1' then + case second_operand(5 downto 0) is + when "000000" => spm00_contents := sx; + when "000001" => spm01_contents := sx; + when "000010" => spm02_contents := sx; + when "000011" => spm03_contents := sx; + when "000100" => spm04_contents := sx; + when "000101" => spm05_contents := sx; + when "000110" => spm06_contents := sx; + when "000111" => spm07_contents := sx; + when "001000" => spm08_contents := sx; + when "001001" => spm09_contents := sx; + when "001010" => spm0a_contents := sx; + when "001011" => spm0b_contents := sx; + when "001100" => spm0c_contents := sx; + when "001101" => spm0d_contents := sx; + when "001110" => spm0e_contents := sx; + when "001111" => spm0f_contents := sx; + when "010000" => spm10_contents := sx; + when "010001" => spm11_contents := sx; + when "010010" => spm12_contents := sx; + when "010011" => spm13_contents := sx; + when "010100" => spm14_contents := sx; + when "010101" => spm15_contents := sx; + when "010110" => spm16_contents := sx; + when "010111" => spm17_contents := sx; + when "011000" => spm18_contents := sx; + when "011001" => spm19_contents := sx; + when "011010" => spm1a_contents := sx; + when "011011" => spm1b_contents := sx; + when "011100" => spm1c_contents := sx; + when "011101" => spm1d_contents := sx; + when "011110" => spm1e_contents := sx; + when "011111" => spm1f_contents := sx; + when "100000" => spm20_contents := sx; + when "100001" => spm21_contents := sx; + when "100010" => spm22_contents := sx; + when "100011" => spm23_contents := sx; + when "100100" => spm24_contents := sx; + when "100101" => spm25_contents := sx; + when "100110" => spm26_contents := sx; + when "100111" => spm27_contents := sx; + when "101000" => spm28_contents := sx; + when "101001" => spm29_contents := sx; + when "101010" => spm2a_contents := sx; + when "101011" => spm2b_contents := sx; + when "101100" => spm2c_contents := sx; + when "101101" => spm2d_contents := sx; + when "101110" => spm2e_contents := sx; + when "101111" => spm2f_contents := sx; + when "110000" => spm30_contents := sx; + when "110001" => spm31_contents := sx; + when "110010" => spm32_contents := sx; + when "110011" => spm33_contents := sx; + when "110100" => spm34_contents := sx; + when "110101" => spm35_contents := sx; + when "110110" => spm36_contents := sx; + when "110111" => spm37_contents := sx; + when "111000" => spm38_contents := sx; + when "111001" => spm39_contents := sx; + when "111010" => spm3a_contents := sx; + when "111011" => spm3b_contents := sx; + when "111100" => spm3c_contents := sx; + when "111101" => spm3d_contents := sx; + when "111110" => spm3e_contents := sx; + when "111111" => spm3f_contents := sx; + when others => null; + end case; + end if; + + end if; + + end process simulation; + + --synthesis translate on +-- +--********************************************************************************** +-- End of simulation code. +--********************************************************************************** +-- +-- +end low_level_definition; +-- +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCPSM3.VHD +-- +------------------------------------------------------------------------------------ diff --git a/projects/PicoBlaze/src/kcpsm3_int_test.vhd b/projects/PicoBlaze/src/kcpsm3_int_test.vhd new file mode 100644 index 0000000..2b422c9 --- /dev/null +++ b/projects/PicoBlaze/src/kcpsm3_int_test.vhd @@ -0,0 +1,155 @@ +-- +-- Interrupt test for KCPSM3 +-- +-- Ken Chapman - Xilinx Ltd - June 2003 +-- +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +-- +------------------------------------------------------------------------------------ +-- +-- +entity kcpsm3_int_test is + Port ( counter : out std_logic_vector(7 downto 0); + waveforms : out std_logic_vector(7 downto 0); + interrupt_event : in std_logic; + clk : in std_logic); + end kcpsm3_int_test; +-- +------------------------------------------------------------------------------------ +-- +-- Start of test achitecture +-- +architecture Behavioral of kcpsm3_int_test is +-- +------------------------------------------------------------------------------------ +-- +-- declaration of KCPSM3 +-- + component kcpsm3 + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end component; +-- +-- declaration of program ROM +-- + component int_test + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used to connect KCPSM3 to program ROM and I/O logic +-- +signal address : std_logic_vector(9 downto 0); +signal instruction : std_logic_vector(17 downto 0); +signal port_id : std_logic_vector(7 downto 0); +signal out_port : std_logic_vector(7 downto 0); +signal in_port : std_logic_vector(7 downto 0); +signal write_strobe : std_logic; +signal read_strobe : std_logic; +signal interrupt : std_logic :='0'; +signal interrupt_ack : std_logic; +signal reset : std_logic; +-- +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- +-- Start of circuit description +-- +begin + + -- Inserting KCPSM3 and the program memory + + processor: kcpsm3 + port map( address => address, + instruction => instruction, + port_id => port_id, + write_strobe => write_strobe, + out_port => out_port, + read_strobe => read_strobe, + in_port => in_port, + interrupt => interrupt, + interrupt_ack => interrupt_ack, + reset => reset, + clk => clk); + + program: int_test + port map( address => address, + instruction => instruction, + clk => clk); + + -- Unused inputs on processor + + in_port <= "00000000"; + reset <= '0'; + + -- Adding the output registers to the processor + + IO_registers: process(clk) + begin + + if clk'event and clk='1' then + + -- waveform register at address 02 + if port_id(1)='1' and write_strobe='1' then + waveforms <= out_port; + end if; + + -- Interrupt Counter register at address 04 + if port_id(2)='1' and write_strobe='1' then + counter <= out_port; + end if; + + end if; + + end process IO_registers; + + + + -- Adding the interrupt input + -- Note that the initial value of interrupt (low) is + -- defined at signal declaration. + + interrupt_control: process(clk) + begin + + if clk'event and clk='1' then + if interrupt_ack='1' then + interrupt <= '0'; + elsif interrupt_event='1' then + interrupt <= '1'; + else + interrupt <= interrupt; + end if; + end if; + + end process interrupt_control; + +end Behavioral; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCPSM3_INT_TEST.VHD +-- +------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/src/kcuart9_rx.vhd b/projects/PicoBlaze/src/kcuart9_rx.vhd new file mode 100644 index 0000000..e995ead --- /dev/null +++ b/projects/PicoBlaze/src/kcuart9_rx.vhd @@ -0,0 +1,351 @@ +-- 9-Bit Constant (K) Compact UART Receiver +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be checked externally and is provided as data_out(8). +-- +-- Version : 1.00 (derived from kcuart_rx version 1.00) +-- Version Date : 11th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART9_RX +-- +entity kcuart9_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end kcuart9_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART9_RX +-- +architecture low_level_definition of kcuart9_rx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART9_RX +-- +------------------------------------------------------------------------------------ +-- +signal sync_serial : std_logic; +signal stop_bit : std_logic; +signal data_int : std_logic_vector(8 downto 0); +signal data_delay : std_logic_vector(8 downto 0); +signal start_delay : std_logic; +signal start_bit : std_logic; +signal edge_delay : std_logic; +signal start_edge : std_logic; +signal decode_valid_char : std_logic; +signal valid_char : std_logic; +signal decode_purge : std_logic; +signal purge : std_logic; +signal valid_srl_delay : std_logic_vector(9 downto 0); +signal valid_reg_delay : std_logic_vector(9 downto 0); +signal decode_data_strobe : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of start_srl : label is "0000"; +attribute INIT of edge_srl : label is "0000"; +attribute INIT of valid_lut : label is "0040"; +attribute INIT of purge_lut : label is "54"; +attribute INIT of strobe_lut : label is "8"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART9_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Synchronise input serial data to system clock + + sync_reg: FD + port map ( D => serial_in, + Q => sync_serial, + C => clk); + + stop_reg: FD + port map ( D => sync_serial, + Q => stop_bit, + C => clk); + + + -- Data delays to capture data at 16 times baud rate + -- Each SRL16E is followed by a flip-flop for best timing + + data_loop: for i in 0 to 8 generate + begin + + lsbs: if i<8 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(i+1), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate lsbs; + + msb: if i=8 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => stop_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate msb; + + data_reg: FDE + port map ( D => data_delay(i), + Q => data_int(i), + CE => en_16_x_baud, + C => clk); + + end generate data_loop; + + -- Assign internal signals to outputs + + data_out <= data_int; + + -- Data delays to capture start bit at 16 time baud rate + + start_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(0), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => start_delay ); + + start_reg: FDE + port map ( D => start_delay, + Q => start_bit, + CE => en_16_x_baud, + C => clk); + + + -- Data delays to capture start bit leading edge at 16 time baud rate + -- Delay ensures data is captured at mid-bit position + + edge_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => start_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '0', + Q => edge_delay ); + + edge_reg: FDE + port map ( D => edge_delay, + Q => start_edge, + CE => en_16_x_baud, + C => clk); + + -- Detect a valid character + + valid_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0040") + --synthesis translate_on + port map( I0 => purge, + I1 => stop_bit, + I2 => start_edge, + I3 => edge_delay, + O => decode_valid_char ); + + valid_reg: FDE + port map ( D => decode_valid_char, + Q => valid_char, + CE => en_16_x_baud, + C => clk); + + -- Purge of data status + + purge_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"54") + --synthesis translate_on + port map( I0 => valid_reg_delay(9), + I1 => valid_char, + I2 => purge, + O => decode_purge ); + + purge_reg: FDE + port map ( D => decode_purge, + Q => purge, + CE => en_16_x_baud, + C => clk); + + -- Delay of valid_char pulse of length equivalent to the time taken + -- to purge data shift register of all data which has been used. + -- Requires 10x16 + 8 delays which is achieved by packing of SRL16E with + -- up to 16 delays and utilising the dedicated flip flop in each stage. + + valid_loop: for i in 0 to 9 generate + begin + + lsb: if i=0 generate + -- + attribute INIT : string; + attribute INIT of delay14_srl : label is "0000"; + -- + begin + + delay14_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_char, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate lsb; + + msbs: if i>0 generate + -- + attribute INIT : string; + attribute INIT of delay16_srl : label is "0000"; + -- + begin + + delay16_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_reg_delay(i-1), + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '1', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate msbs; + + data_reg: FDE + port map ( D => valid_srl_delay(i), + Q => valid_reg_delay(i), + CE => en_16_x_baud, + C => clk); + + end generate valid_loop; + + -- Form data strobe + + strobe_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => valid_char, + I1 => en_16_x_baud, + O => decode_data_strobe ); + + strobe_reg: FD + port map ( D => decode_data_strobe, + Q => data_strobe, + C => clk); + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART9_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/kcuart9_tx.vhd b/projects/PicoBlaze/src/kcuart9_tx.vhd new file mode 100644 index 0000000..0726bf8 --- /dev/null +++ b/projects/PicoBlaze/src/kcuart9_tx.vhd @@ -0,0 +1,433 @@ +-- Constant (K) Compact UART Transmitter +-- +-- 9-Bit UART Transmitter +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be computed externally and provided as data_in(8). +-- +-- NOTE : This macro is intended to be attached to bbfifo_16x9 and operation requires the +-- interaction of signals to and from that FIFO buffer to work correctly. +-- +-- Version : 1.00 (derived from kcuart_tx version 1.10) +-- Version Date : 10th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART9_TX +-- +entity kcuart9_tx is + Port ( data_in : in std_logic_vector(8 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + tx_complete : out std_logic; + clk : in std_logic); + end kcuart9_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART9_TX +-- +architecture low_level_definition of kcuart9_tx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART9_TX +-- +------------------------------------------------------------------------------------ +-- +signal data_01 : std_logic; +signal data_23 : std_logic; +signal data_45 : std_logic; +signal data_67 : std_logic; +signal data_0123 : std_logic; +signal data_4567 : std_logic; +signal data_01234567 : std_logic; +signal data_01234567_reg : std_logic; + +signal data8_buf : std_logic; +signal force_serial : std_logic; +signal next_serial : std_logic; + +signal bit_count : std_logic_vector(2 downto 0); +signal next_bit_count : std_logic_vector(2 downto 0); +signal half_bit_count : std_logic_vector(2 downto 0); +signal bit_count_cy : std_logic_vector(1 downto 0); + +signal baud_count : std_logic_vector(3 downto 0); +signal next_baud_count : std_logic_vector(3 downto 0); +signal half_baud_count : std_logic_vector(3 downto 0); +signal baud_count_cy : std_logic_vector(3 downto 0); +signal tx_bit_en : std_logic; + +signal decode7 : std_logic; +signal sel_last_bit : std_logic; +signal parity_bit : std_logic; +signal next_transmit : std_logic; +signal transmit : std_logic; +signal next_tx_complete : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of mux1_lut : label is "E4"; +attribute INIT of mux2_lut : label is "E4"; +attribute INIT of mux3_lut : label is "E4"; +attribute INIT of mux4_lut : label is "E4"; + +attribute INIT of buf_data8 : label is "2"; +attribute INIT of force_lut : label is "E0FF"; + +attribute INIT of count7_lut : label is "80"; +attribute INIT of transmit_lut : label is "32"; +attribute INIT of complete_lut : label is "8"; + +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART9_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + mux1_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(0), + I2 => data_in(1), + O => data_01 ); + + mux2_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(2), + I2 => data_in(3), + O => data_23 ); + + mux3_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(4), + I2 => data_in(5), + O => data_45 ); + + mux4_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"E4") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => data_in(6), + I2 => data_in(7), + O => data_67 ); + + + mux5_muxf5: MUXF5 + port map( I1 => data_23, + I0 => data_01, + S => bit_count(1), + O => data_0123 ); + + mux6_muxf5: MUXF5 + port map( I1 => data_67, + I0 => data_45, + S => bit_count(1), + O => data_4567 ); + + mux7_muxf6: MUXF6 + port map( I1 => data_4567, + I0 => data_0123, + S => bit_count(2), + O => data_01234567 ); + + pipeline_mux: FD + port map ( D => data_01234567, + Q => data_01234567_reg, + C => clk); + + -- Serial output logic + + buf_data8: LUT1 + --synthesis translate_off + generic map (INIT => X"2") + --synthesis translate_on + port map( I0 => data_in(8), + O => data8_buf ); + + force_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E0FF") + --synthesis translate_on + port map( I0 => data_01234567_reg, + I1 => parity_bit, + I2 => transmit, + I3 => send_character, + O => force_serial ); + + + mux8_muxf5: MUXF5 + port map( I1 => data8_buf, + I0 => force_serial, + S => sel_last_bit, + O => next_serial ); + + -- Final output flip-flop initialised to start at '1' + high_start: for i in 1 to 1 generate + -- + attribute INIT : bit; + attribute INIT of output_reg : label is '1'; + -- + begin + + output_reg: FDE + --synthesis translate_off + generic map (INIT => '1') + --synthesis translate_on + port map ( D => next_serial, + Q => serial_out, + CE => tx_bit_en, + C => clk); + + end generate high_start; + + + -- bit counter + + bit_count_loop: for i in 0 to 2 generate + -- + attribute INIT : string; + attribute INIT of bit_count_lut : label is "B"; + -- + begin + + bit_reg: FDE + port map ( D => next_bit_count(i), + Q => bit_count(i), + CE => tx_bit_en, + C => clk); + + bit_count_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"B") + --synthesis translate_on + port map( I0 => bit_count(i), + I1 => transmit, + O => half_bit_count(i)); + + lsb_bit_count: if i=0 generate + begin + + bit_count_xor: XORCY + port map( LI => half_bit_count(i), + CI => '1', + O => next_bit_count(i)); + + bit_count_muxcy: MUXCY + port map( DI => '0', + CI => '1', + S => half_bit_count(i), + O => bit_count_cy(i)); + + end generate lsb_bit_count; + + upper_bit_count: if i>0 generate + begin + + bit_count_xor: XORCY + port map( LI => half_bit_count(i), + CI => bit_count_cy(i-1), + O => next_bit_count(i)); + + middle_bit_count: if i=1 generate + begin + + bit_count_muxcy: MUXCY + port map( DI => '0', + CI => bit_count_cy(i-1), + S => half_bit_count(i), + O => bit_count_cy(i)); + + end generate middle_bit_count; + + end generate upper_bit_count; + + end generate bit_count_loop; + + + -- baud counter + + baud_count_loop: for i in 0 to 3 generate + -- + attribute INIT : string; + attribute INIT of baud_count_lut : label is "2"; + -- + begin + + baud_reg: FDE + port map ( D => next_baud_count(i), + Q => baud_count(i), + CE => en_16_x_baud, + C => clk); + + baud_count_lut: LUT1 + --synthesis translate_off + generic map (INIT => X"2") + --synthesis translate_on + port map( I0 => baud_count(i), + O => half_baud_count(i)); + + lsb_baud_count: if i=0 generate + begin + + baud_count_xor: XORCY + port map( LI => half_baud_count(i), + CI => en_16_x_baud, + O => next_baud_count(i)); + + baud_count_muxcy: MUXCY + port map( DI => '0', + CI => en_16_x_baud, + S => half_baud_count(i), + O => baud_count_cy(i)); + + end generate lsb_baud_count; + + upper_baud_count: if i>0 generate + begin + + baud_count_xor: XORCY + port map( LI => half_baud_count(i), + CI => baud_count_cy(i-1), + O => next_baud_count(i)); + + baud_count_muxcy: MUXCY + port map( DI => '0', + CI => baud_count_cy(i-1), + S => half_baud_count(i), + O => baud_count_cy(i)); + + end generate upper_baud_count; + + end generate baud_count_loop; + + bit_en_reg: FD + port map ( D => baud_count_cy(3), + Q => tx_bit_en, + C => clk); + + -- state machine + + count7_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"80") + --synthesis translate_on + port map( I0 => bit_count(0), + I1 => bit_count(1), + I2 => bit_count(2), + O => decode7 ); + + sel_last_reg: FDE + port map ( D => decode7, + Q => sel_last_bit, + CE => tx_bit_en, + C => clk); + + parity_reg: FDE + port map ( D => sel_last_bit, + Q => parity_bit, + CE => tx_bit_en, + C => clk); + + transmit_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"32") + --synthesis translate_on + port map( I0 => send_character, + I1 => parity_bit, + I2 => transmit, + O => next_transmit ); + + transmit_reg: FDE + port map ( D => next_transmit, + Q => transmit, + CE => tx_bit_en, + C => clk); + + complete_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => parity_bit, + I1 => tx_bit_en, + O => next_tx_complete ); + + complete_reg: FD + port map ( D => next_tx_complete, + Q => tx_complete, + C => clk); + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART9_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/kcuart_rx.vhd b/projects/PicoBlaze/src/kcuart_rx.vhd new file mode 100644 index 0000000..7c22540 --- /dev/null +++ b/projects/PicoBlaze/src/kcuart_rx.vhd @@ -0,0 +1,352 @@ +-- Constant (K) Compact UART Receiver +-- +-- Version : 1.10 +-- Version Date : 3rd December 2003 +-- Reason : '--translate' directives changed to '--synthesis translate' directives +-- +-- Version : 1.00 +-- Version Date : 16th October 2002 +-- +-- Start of design entry : 16th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART_RX +-- +entity kcuart_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end kcuart_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART_RX +-- +architecture low_level_definition of kcuart_rx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART_RX +-- +------------------------------------------------------------------------------------ +-- +signal sync_serial : std_logic; +signal stop_bit : std_logic; +signal data_int : std_logic_vector(7 downto 0); +signal data_delay : std_logic_vector(7 downto 0); +signal start_delay : std_logic; +signal start_bit : std_logic; +signal edge_delay : std_logic; +signal start_edge : std_logic; +signal decode_valid_char : std_logic; +signal valid_char : std_logic; +signal decode_purge : std_logic; +signal purge : std_logic; +signal valid_srl_delay : std_logic_vector(8 downto 0); +signal valid_reg_delay : std_logic_vector(8 downto 0); +signal decode_data_strobe : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of start_srl : label is "0000"; +attribute INIT of edge_srl : label is "0000"; +attribute INIT of valid_lut : label is "0040"; +attribute INIT of purge_lut : label is "54"; +attribute INIT of strobe_lut : label is "8"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Synchronise input serial data to system clock + + sync_reg: FD + port map ( D => serial_in, + Q => sync_serial, + C => clk); + + stop_reg: FD + port map ( D => sync_serial, + Q => stop_bit, + C => clk); + + + -- Data delays to capture data at 16 time baud rate + -- Each SRL16E is followed by a flip-flop for best timing + + data_loop: for i in 0 to 7 generate + begin + + lsbs: if i<7 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(i+1), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate lsbs; + + msb: if i=7 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => stop_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => data_delay(i) ); + + end generate msb; + + data_reg: FDE + port map ( D => data_delay(i), + Q => data_int(i), + CE => en_16_x_baud, + C => clk); + + end generate data_loop; + + -- Assign internal signals to outputs + + data_out <= data_int; + + -- Data delays to capture start bit at 16 time baud rate + + start_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => data_int(0), + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => start_delay ); + + start_reg: FDE + port map ( D => start_delay, + Q => start_bit, + CE => en_16_x_baud, + C => clk); + + + -- Data delays to capture start bit leading edge at 16 time baud rate + -- Delay ensures data is captured at mid-bit position + + edge_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => start_bit, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '0', + Q => edge_delay ); + + edge_reg: FDE + port map ( D => edge_delay, + Q => start_edge, + CE => en_16_x_baud, + C => clk); + + -- Detect a valid character + + valid_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0040") + --synthesis translate_on + port map( I0 => purge, + I1 => stop_bit, + I2 => start_edge, + I3 => edge_delay, + O => decode_valid_char ); + + valid_reg: FDE + port map ( D => decode_valid_char, + Q => valid_char, + CE => en_16_x_baud, + C => clk); + + -- Purge of data status + + purge_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"54") + --synthesis translate_on + port map( I0 => valid_reg_delay(8), + I1 => valid_char, + I2 => purge, + O => decode_purge ); + + purge_reg: FDE + port map ( D => decode_purge, + Q => purge, + CE => en_16_x_baud, + C => clk); + + -- Delay of valid_char pulse of length equivalent to the time taken + -- to purge data shift register of all data which has been used. + -- Requires 9x16 + 8 delays which is achieved by packing of SRL16E with + -- up to 16 delays and utilising the dedicated flip flop in each stage. + + valid_loop: for i in 0 to 8 generate + begin + + lsb: if i=0 generate + -- + attribute INIT : string; + attribute INIT of delay15_srl : label is "0000"; + -- + begin + + delay15_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_char, + CE => en_16_x_baud, + CLK => clk, + A0 => '0', + A1 => '1', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate lsb; + + msbs: if i>0 generate + -- + attribute INIT : string; + attribute INIT of delay16_srl : label is "0000"; + -- + begin + + delay16_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => valid_reg_delay(i-1), + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '1', + A2 => '1', + A3 => '1', + Q => valid_srl_delay(i) ); + + end generate msbs; + + data_reg: FDE + port map ( D => valid_srl_delay(i), + Q => valid_reg_delay(i), + CE => en_16_x_baud, + C => clk); + + end generate valid_loop; + + -- Form data strobe + + strobe_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => valid_char, + I1 => en_16_x_baud, + O => decode_data_strobe ); + + strobe_reg: FD + port map ( D => decode_data_strobe, + Q => data_strobe, + C => clk); + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/kcuart_tx.vhd b/projects/PicoBlaze/src/kcuart_tx.vhd new file mode 100644 index 0000000..b8fec85 --- /dev/null +++ b/projects/PicoBlaze/src/kcuart_tx.vhd @@ -0,0 +1,394 @@ +-- Constant (K) Compact UART Transmitter +-- +-- Version : 1.10 +-- Version Date : 3rd December 2003 +-- Reason : '--translate' directives changed to '--synthesis translate' directives +-- +-- Version : 1.00 +-- Version Date : 14th October 2002 +-- +-- Start of design entry : 2nd October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for KCUART_TX +-- +entity kcuart_tx is + Port ( data_in : in std_logic_vector(7 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + Tx_complete : out std_logic; + clk : in std_logic); + end kcuart_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for KCUART_TX +-- +architecture low_level_definition of kcuart_tx is +-- +------------------------------------------------------------------------------------ +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in KCUART_TX +-- +------------------------------------------------------------------------------------ +-- +signal data_01 : std_logic; +signal data_23 : std_logic; +signal data_45 : std_logic; +signal data_67 : std_logic; +signal data_0123 : std_logic; +signal data_4567 : std_logic; +signal data_01234567 : std_logic; +signal bit_select : std_logic_vector(2 downto 0); +signal next_count : std_logic_vector(2 downto 0); +signal mask_count : std_logic_vector(2 downto 0); +signal mask_count_carry : std_logic_vector(2 downto 0); +signal count_carry : std_logic_vector(2 downto 0); +signal ready_to_start : std_logic; +signal decode_Tx_start : std_logic; +signal Tx_start : std_logic; +signal decode_Tx_run : std_logic; +signal Tx_run : std_logic; +signal decode_hot_state : std_logic; +signal hot_state : std_logic; +signal hot_delay : std_logic; +signal Tx_bit : std_logic; +signal decode_Tx_stop : std_logic; +signal Tx_stop : std_logic; +signal decode_Tx_complete : std_logic; +-- +-- +------------------------------------------------------------------------------------ +-- +-- Attributes to define LUT contents during implementation +-- The information is repeated in the generic map for functional simulation-- +-- +------------------------------------------------------------------------------------ +-- +attribute INIT : string; +attribute INIT of mux1_lut : label is "E4FF"; +attribute INIT of mux2_lut : label is "E4FF"; +attribute INIT of mux3_lut : label is "E4FF"; +attribute INIT of mux4_lut : label is "E4FF"; +attribute INIT of ready_lut : label is "10"; +attribute INIT of start_lut : label is "0190"; +attribute INIT of run_lut : label is "1540"; +attribute INIT of hot_state_lut : label is "94"; +attribute INIT of delay14_srl : label is "0000"; +attribute INIT of stop_lut : label is "0180"; +attribute INIT of complete_lut : label is "8"; +-- +------------------------------------------------------------------------------------ +-- +-- Start of KCUART_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + mux1_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(0), + I2 => data_in(1), + I3 => Tx_run, + O => data_01 ); + + mux2_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(2), + I2 => data_in(3), + I3 => Tx_run, + O => data_23 ); + + mux3_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(4), + I2 => data_in(5), + I3 => Tx_run, + O => data_45 ); + + mux4_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"E4FF") + --synthesis translate_on + port map( I0 => bit_select(0), + I1 => data_in(6), + I2 => data_in(7), + I3 => Tx_run, + O => data_67 ); + + mux5_muxf5: MUXF5 + port map( I1 => data_23, + I0 => data_01, + S => bit_select(1), + O => data_0123 ); + + mux6_muxf5: MUXF5 + port map( I1 => data_67, + I0 => data_45, + S => bit_select(1), + O => data_4567 ); + + mux7_muxf6: MUXF6 + port map( I1 => data_4567, + I0 => data_0123, + S => bit_select(2), + O => data_01234567 ); + + -- Register serial output and force start and stop bits + + pipeline_serial: FDRS + port map ( D => data_01234567, + Q => serial_out, + R => Tx_start, + S => Tx_stop, + C => clk); + + -- 3-bit counter + -- Counter is clock enabled by en_16_x_baud + -- Counter will be reset when 'Tx_start' is active + -- Counter will increment when Tx_bit is active + -- Tx_run must be active to count + -- count_carry(2) indicates when terminal count (7) is reached and Tx_bit=1 (ie overflow) + + count_width_loop: for i in 0 to 2 generate + -- + attribute INIT : string; + attribute INIT of count_lut : label is "8"; + -- + begin + + register_bit: FDRE + port map ( D => next_count(i), + Q => bit_select(i), + CE => en_16_x_baud, + R => Tx_start, + C => clk); + + count_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => bit_select(i), + I1 => Tx_run, + O => mask_count(i)); + + mask_and: MULT_AND + port map( I0 => bit_select(i), + I1 => Tx_run, + LO => mask_count_carry(i)); + + lsb_count: if i=0 generate + begin + + count_muxcy: MUXCY + port map( DI => mask_count_carry(i), + CI => Tx_bit, + S => mask_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => mask_count(i), + CI => Tx_bit, + O => next_count(i)); + + end generate lsb_count; + + upper_count: if i>0 generate + begin + + count_muxcy: MUXCY + port map( DI => mask_count_carry(i), + CI => count_carry(i-1), + S => mask_count(i), + O => count_carry(i)); + + count_xor: XORCY + port map( LI => mask_count(i), + CI => count_carry(i-1), + O => next_count(i)); + + end generate upper_count; + + end generate count_width_loop; + + -- Ready to start decode + + ready_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"10") + --synthesis translate_on + port map( I0 => Tx_run, + I1 => Tx_start, + I2 => send_character, + O => ready_to_start ); + + -- Start bit enable + + start_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0190") + --synthesis translate_on + port map( I0 => Tx_bit, + I1 => Tx_stop, + I2 => ready_to_start, + I3 => Tx_start, + O => decode_Tx_start ); + + Tx_start_reg: FDE + port map ( D => decode_Tx_start, + Q => Tx_start, + CE => en_16_x_baud, + C => clk); + + + -- Run bit enable + + run_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"1540") + --synthesis translate_on + port map( I0 => count_carry(2), + I1 => Tx_bit, + I2 => Tx_start, + I3 => Tx_run, + O => decode_Tx_run ); + + Tx_run_reg: FDE + port map ( D => decode_Tx_run, + Q => Tx_run, + CE => en_16_x_baud, + C => clk); + + -- Bit rate enable + + hot_state_lut: LUT3 + --synthesis translate_off + generic map (INIT => X"94") + --synthesis translate_on + port map( I0 => Tx_stop, + I1 => ready_to_start, + I2 => Tx_bit, + O => decode_hot_state ); + + hot_state_reg: FDE + port map ( D => decode_hot_state, + Q => hot_state, + CE => en_16_x_baud, + C => clk); + + delay14_srl: SRL16E + --synthesis translate_off + generic map (INIT => X"0000") + --synthesis translate_on + port map( D => hot_state, + CE => en_16_x_baud, + CLK => clk, + A0 => '1', + A1 => '0', + A2 => '1', + A3 => '1', + Q => hot_delay ); + + Tx_bit_reg: FDE + port map ( D => hot_delay, + Q => Tx_bit, + CE => en_16_x_baud, + C => clk); + + -- Stop bit enable + + stop_lut: LUT4 + --synthesis translate_off + generic map (INIT => X"0180") + --synthesis translate_on + port map( I0 => Tx_bit, + I1 => Tx_run, + I2 => count_carry(2), + I3 => Tx_stop, + O => decode_Tx_stop ); + + Tx_stop_reg: FDE + port map ( D => decode_Tx_stop, + Q => Tx_stop, + CE => en_16_x_baud, + C => clk); + + -- Tx_complete strobe + + complete_lut: LUT2 + --synthesis translate_off + generic map (INIT => X"8") + --synthesis translate_on + port map( I0 => count_carry(2), + I1 => en_16_x_baud, + O => decode_Tx_complete ); + + Tx_complete_reg: FD + port map ( D => decode_Tx_complete, + Q => Tx_complete, + C => clk); + + +end low_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE KCUART_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/test_bench.vhd b/projects/PicoBlaze/src/test_bench.vhd new file mode 100644 index 0000000..2308394 --- /dev/null +++ b/projects/PicoBlaze/src/test_bench.vhd @@ -0,0 +1,77 @@ +-- Test Bench for kcpsm3_int_test.vhd +-- +-- Ken Chapman - Xilinx Ltd - June 2003 +-- +-- +LIBRARY ieee; +USE ieee.std_logic_1164.ALL; +USE ieee.numeric_std.ALL; + +ENTITY testbench IS +END testbench; + +ARCHITECTURE behavior OF testbench IS + + -- Design to be tested + + COMPONENT kcpsm3_int_test + Port ( counter : out std_logic_vector(7 downto 0); + waveforms : out std_logic_vector(7 downto 0); + interrupt_event : in std_logic; + clk : in std_logic); + END COMPONENT; + +-- signals to connect kcpsm3_int_test + +SIGNAL counter : std_logic_vector(7 downto 0); +SIGNAL waveforms : std_logic_vector(7 downto 0); +SIGNAL interrupt_event : std_logic := '0'; +SIGNAL clk : std_logic := '0'; + +BEGIN + +-- Define the unit under test + + uut: kcpsm3_int_test + port map ( counter => counter, + waveforms => waveforms, + interrupt_event => interrupt_event, + clk => clk); + + +-- Test Bench begins + + -- Nominal 50MHz clock which also defines number of cycles in simulation + test_clock: process + variable max_cycles : integer :=400; + variable cycle_count : integer := 0; + begin + -- Define the clock cycles and the clock cycle counter + while cycle_count < max_cycles loop + clk <= '0'; + wait for 10 ns; + clk <= '1'; + cycle_count := cycle_count + 1; + wait for 10 ns; + + --Now define stimulus relative to a given clock cycle + + case cycle_count is + + when 30 => interrupt_event <= '1'; + + when 67 => interrupt_event <= '1'; + + when 183 => interrupt_event <= '1'; + + when others => interrupt_event <= '0'; -- no interrupt + + end case; + + end loop; + + wait; -- end of simulation. + + end process; + +END; diff --git a/projects/PicoBlaze/src/uart9_rx.vhd b/projects/PicoBlaze/src/uart9_rx.vhd new file mode 100644 index 0000000..4b9e8a5 --- /dev/null +++ b/projects/PicoBlaze/src/uart9_rx.vhd @@ -0,0 +1,148 @@ +-- 9-Bit UART Receiver with integral 16 byte FIFO buffer +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be checked externally and is provided as data_out(8). +-- +-- Version : 1.00 (derived from uart_rx version 1.00) +-- Version Date : 11th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART9_RX +-- +entity uart9_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart9_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART9_RX +-- +architecture macro_level_definition of uart9_rx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART9_RX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART Receiver +-- +component kcuart9_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(8 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end component; +-- +-- 'Bucket Brigade' FIFO +-- +component bbfifo_16x9 + Port ( data_in : in std_logic_vector(8 downto 0); + data_out : out std_logic_vector(8 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART9_RX +-- +------------------------------------------------------------------------------------ +-- +signal uart_data_out : std_logic_vector(8 downto 0); +signal fifo_write : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART9_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Constant (K) Compact UART 9-bit Receiver + + receiver: kcuart9_rx + port map ( serial_in => serial_in, + data_out => uart_data_out, + data_strobe => fifo_write, + en_16_x_baud => en_16_x_baud, + clk => clk ); + + -- 9-bit 'Bucket Brigade' FIFO + + buf: bbfifo_16x9 + port map ( data_in => uart_data_out, + data_out => data_out, + reset => reset_buffer, + write => fifo_write, + read => read_buffer, + full => buffer_full, + half_full => buffer_half_full, + data_present => buffer_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART9_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/uart9_tx.vhd b/projects/PicoBlaze/src/uart9_tx.vhd new file mode 100644 index 0000000..9f2d3be --- /dev/null +++ b/projects/PicoBlaze/src/uart9_tx.vhd @@ -0,0 +1,150 @@ +-- 9-Bit UART Transmitter with integral 16 byte FIFO buffer +-- +-- 9 data bits, no parity, 1 stop bit +-- or +-- 8 data bits, parity, 1 stop bit +-- where the value of the parity bit must be computed externally and provided as data_in(8). +-- +-- Version : 1.00 (derived from uart_tx version 1.00) +-- Version Date : 10th February 2005 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2005. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART9_TX +-- +entity uart9_tx is + Port ( data_in : in std_logic_vector(8 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart9_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART_TX +-- +architecture macro_level_definition of uart9_tx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART9_TX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART 9-bit Transmitter +-- +component kcuart9_tx + Port ( data_in : in std_logic_vector(8 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + tx_complete : out std_logic; + clk : in std_logic); + end component; +-- +-- 9-bit 'Bucket Brigade' FIFO +-- +component bbfifo_16x9 + Port ( data_in : in std_logic_vector(8 downto 0); + data_out : out std_logic_vector(8 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART9_TX +-- +------------------------------------------------------------------------------------ +-- +signal fifo_data_out : std_logic_vector(8 downto 0); +signal fifo_data_present : std_logic; +signal fifo_read : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- Constant (K) Compact UART 9-bit Transmitter + + transmitter: kcuart9_tx + port map ( data_in => fifo_data_out, + send_character => fifo_data_present, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + Tx_complete => fifo_read, + clk => clk); + + -- 9-bit 'Bucket Brigade' FIFO + + buf: bbfifo_16x9 + port map ( data_in => data_in, + data_out => fifo_data_out, + reset => reset_buffer, + write => write_buffer, + read => fifo_read, + full => buffer_full, + half_full => buffer_half_full, + data_present => fifo_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART_TX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/uart_clock.vhd b/projects/PicoBlaze/src/uart_clock.vhd new file mode 100644 index 0000000..cac9bf4 --- /dev/null +++ b/projects/PicoBlaze/src/uart_clock.vhd @@ -0,0 +1,367 @@ +-- +-- KCPSM3 reference design - Real Time Clock with UART communications +-- +-- Ken Chapman - Xilinx Ltd - October 2003 +-- +-- The design demonstrates the following:- +-- Connection of KCPSM3 to Program ROM +-- Connection of UART macros supplied with PicoBlaze with +-- Baud rate generation +-- Definition of input and output ports with +-- Minimum decoding +-- Pipelining where appropriate +-- Interrupt circuit with +-- Simple fixed period timer +-- Automatic clearing using interrupt acknowledge from KCPSM3 +-- +-- The design is set up for a 55MHz system clock and UART communications rate of 38400 baud. +-- Please read design documentation to modify to your own requirements. +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2003. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Furthermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- Standard IEEE libraries +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +Library UNISIM; +use UNISIM.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- +entity uart_clock is + Port ( sys_TX : out std_logic; + sys_RX : in std_logic; + sys_alarm : out std_logic; + sys_clk_in : in std_logic; + sys_rst_in : in std_logic); + end uart_clock; +-- +------------------------------------------------------------------------------------ +-- +-- Start of test architecture +-- +architecture Behavioral of uart_clock is +-- +------------------------------------------------------------------------------------ +-- +-- declaration of KCPSM3 +-- + component kcpsm3 + Port ( address : out std_logic_vector(9 downto 0); + instruction : in std_logic_vector(17 downto 0); + port_id : out std_logic_vector(7 downto 0); + write_strobe : out std_logic; + out_port : out std_logic_vector(7 downto 0); + read_strobe : out std_logic; + in_port : in std_logic_vector(7 downto 0); + interrupt : in std_logic; + interrupt_ack : out std_logic; + reset : in std_logic; + clk : in std_logic); + end component; +-- +-- declaration of program ROM +-- + component uclock + Port ( address : in std_logic_vector(9 downto 0); + instruction : out std_logic_vector(17 downto 0); + clk : in std_logic); + end component; +-- +-- declaration of UART transmitter with integral 16 byte FIFO buffer +-- + component uart_tx + Port ( data_in : in std_logic_vector(7 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; +-- +-- declaration of UART Receiver with integral 16 byte FIFO buffer +-- + component uart_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used to connect KCPSM3 to program ROM and I/O logic +-- +signal address : std_logic_vector(9 downto 0); +signal instruction : std_logic_vector(17 downto 0); +signal port_id : std_logic_vector(7 downto 0); +signal out_port : std_logic_vector(7 downto 0); +signal in_port : std_logic_vector(7 downto 0); +signal write_strobe : std_logic; +signal read_strobe : std_logic; +signal interrupt : std_logic; +signal interrupt_ack : std_logic; +signal pico_rst : std_logic; +signal clk : std_logic; + +-- +-- Signals for connection of peripherals +-- +signal uart_status_port : std_logic_vector(7 downto 0); +-- +-- Signals to form an timer generating an interrupt every microsecond +-- +signal timer_count : integer range 0 to 127 :=0; +signal timer_pulse : std_logic; +-- +-- Signals for UART connections +-- +signal baud_count : integer range 0 to 255 :=0; +signal en_16_x_baud : std_logic; +signal write_to_uart : std_logic; +signal tx_full : std_logic; +signal tx_half_full : std_logic; +signal read_from_uart : std_logic; +signal rx_data : std_logic_vector(7 downto 0); +signal rx_data_present : std_logic; +signal rx_full : std_logic; +signal rx_half_full : std_logic; + +-- +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +-- +-- Start of circuit description +-- +begin + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- KCPSM3 and the program memory + ---------------------------------------------------------------------------------------------------------------------------------- + -- +BUFG_inst : BUFG +port map ( + O => clk, -- Clock buffer output + I => sys_clk_in -- Clock buffer input + ); + + pico_rst <= not sys_rst_in; + + processor: kcpsm3 + port map( address => address, + instruction => instruction, + port_id => port_id, + write_strobe => write_strobe, + out_port => out_port, + read_strobe => read_strobe, + in_port => in_port, + interrupt => interrupt, + interrupt_ack => interrupt_ack, + reset => pico_rst, + clk => clk); + + program_rom: uclock + port map( address => address, + instruction => instruction, + clk => clk); + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- Interrupt + ---------------------------------------------------------------------------------------------------------------------------------- + -- + -- + -- Interrupt is a generated once every 100 clock cycles to provide a 1us reference. + -- Interrupt is automatically cleared by interrupt acknowledgment from KCPSM3. + -- + + Timer: process(clk) + begin + + if clk'event and clk='1' then + + if timer_count=99 then + timer_count <= 0; + timer_pulse <= '1'; + else + timer_count <= timer_count + 1; + timer_pulse <= '0'; + end if; + + if interrupt_ack = '1' then + interrupt <= '0'; + elsif timer_pulse = '1' then + interrupt <= '1'; + else + interrupt <= interrupt; + end if; + + end if; + + end process Timer; + + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- KCPSM3 input ports + ---------------------------------------------------------------------------------------------------------------------------------- + -- + -- + -- UART FIFO status signals to form a bus + -- + + uart_status_port <= "000" & rx_data_present & rx_full & rx_half_full & tx_full & tx_half_full ; + + -- + -- The inputs connect via a pipelined multiplexer + -- + + input_ports: process(clk) + begin + if clk'event and clk='1' then + + case port_id(0) is + + + -- read UART status at address 00 hex + when '0' => in_port <= uart_status_port; + + -- read UART receive data at address 01 hex + when '1' => in_port <= rx_data; + + -- Don't care used for all other addresses to ensure minimum logic implementation + when others => in_port <= "XXXXXXXX"; + + end case; + + -- Form read strobe for UART receiver FIFO buffer. + -- The fact that the read strobe will occur after the actual data is read by + -- the KCPSM3 is acceptable because it is really means 'I have read you'! + + read_from_uart <= read_strobe and port_id(0); + + end if; + + end process input_ports; + + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- KCPSM3 output ports + ---------------------------------------------------------------------------------------------------------------------------------- + -- + + -- adding the output registers to the clock processor + + output_ports: process(clk) + begin + + if clk'event and clk='1' then + if write_strobe='1' then + + -- Alarm register at address 00 hex with data bit0 providing control + + if port_id(0)='0' then + sys_alarm <= out_port(0); + end if; + + end if; + + end if; + + end process output_ports; + + -- + -- write to UART transmitter FIFO buffer at address 01 hex. + -- This is a combinatorial decode because the FIFO is the 'port register'. + -- + + write_to_uart <= write_strobe and port_id(0); + + -- + ---------------------------------------------------------------------------------------------------------------------------------- + -- UART + ---------------------------------------------------------------------------------------------------------------------------------- + -- + -- Connect the 8-bit, 1 stop-bit, no parity transmit and receive macros. + -- Each contains an embedded 16-byte FIFO buffer. + -- + + transmit: uart_tx + port map ( data_in => out_port, + write_buffer => write_to_uart, + reset_buffer => '0', + en_16_x_baud => en_16_x_baud, + serial_out => sys_tx, + buffer_full => tx_full, + buffer_half_full => tx_half_full, + clk => clk ); + + receive: uart_rx + port map ( serial_in => sys_rx, + data_out => rx_data, + read_buffer => read_from_uart, + reset_buffer => '0', + en_16_x_baud => en_16_x_baud, + buffer_data_present => rx_data_present, + buffer_full => rx_full, + buffer_half_full => rx_half_full, + clk => clk ); + + -- + -- Set baud rate to 38400 for the UART communications + -- Requires en_16_x_baud to be 614400Hz which is a single cycle pulse every 163 cycles at 100MHz + -- + -- NOTE : If the highest value for baud_count exceeds 127 you will need to adjust + -- the range of integers in the signal declaration for baud_count. + -- + + baud_timer: process(clk) + begin + if clk'event and clk='1' then + if baud_count=162 then + baud_count <= 0; + en_16_x_baud <= '1'; + else + baud_count <= baud_count + 1; + en_16_x_baud <= '0'; + end if; + end if; + end process baud_timer; + + ---------------------------------------------------------------------------------------------------------------------------------- + +end Behavioral; + +------------------------------------------------------------------------------------------------------------------------------------ +-- +-- END OF FILE uart_clock.vhd +-- +------------------------------------------------------------------------------------------------------------------------------------ + diff --git a/projects/PicoBlaze/src/uart_rx.vhd b/projects/PicoBlaze/src/uart_rx.vhd new file mode 100644 index 0000000..b1374e6 --- /dev/null +++ b/projects/PicoBlaze/src/uart_rx.vhd @@ -0,0 +1,146 @@ +-- UART Receiver with integral 16 byte FIFO buffer +-- +-- 8 bit, no parity, 1 stop bit +-- +-- Version : 1.00 +-- Version Date : 16th October 2002 +-- +-- Start of design entry : 16th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART_RX +-- +entity uart_rx is + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + read_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + buffer_data_present : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart_rx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART_RX +-- +architecture macro_level_definition of uart_rx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART_RX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART Receiver +-- +component kcuart_rx + Port ( serial_in : in std_logic; + data_out : out std_logic_vector(7 downto 0); + data_strobe : out std_logic; + en_16_x_baud : in std_logic; + clk : in std_logic); + end component; +-- +-- 'Bucket Brigade' FIFO +-- +component bbfifo_16x8 + Port ( data_in : in std_logic_vector(7 downto 0); + data_out : out std_logic_vector(7 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART_RX +-- +------------------------------------------------------------------------------------ +-- +signal uart_data_out : std_logic_vector(7 downto 0); +signal fifo_write : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART_RX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + kcuart: kcuart_rx + port map ( serial_in => serial_in, + data_out => uart_data_out, + data_strobe => fifo_write, + en_16_x_baud => en_16_x_baud, + clk => clk ); + + + buf: bbfifo_16x8 + port map ( data_in => uart_data_out, + data_out => data_out, + reset => reset_buffer, + write => fifo_write, + read => read_buffer, + full => buffer_full, + half_full => buffer_half_full, + data_present => buffer_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART_RX.VHD +-- +------------------------------------------------------------------------------------ + + diff --git a/projects/PicoBlaze/src/uart_tx.vhd b/projects/PicoBlaze/src/uart_tx.vhd new file mode 100644 index 0000000..4018c92 --- /dev/null +++ b/projects/PicoBlaze/src/uart_tx.vhd @@ -0,0 +1,148 @@ +-- UART Transmitter with integral 16 byte FIFO buffer +-- +-- 8 bit, no parity, 1 stop bit +-- +-- Version : 1.00 +-- Version Date : 14th October 2002 +-- +-- Start of design entry : 14th October 2002 +-- +-- Ken Chapman +-- Xilinx Ltd +-- Benchmark House +-- 203 Brooklands Road +-- Weybridge +-- Surrey KT13 ORH +-- United Kingdom +-- +-- chapman@xilinx.com +-- +------------------------------------------------------------------------------------ +-- +-- NOTICE: +-- +-- Copyright Xilinx, Inc. 2002. This code may be contain portions patented by other +-- third parties. By providing this core as one possible implementation of a standard, +-- Xilinx is making no representation that the provided implementation of this standard +-- is free from any claims of infringement by any third party. Xilinx expressly +-- disclaims any warranty with respect to the adequacy of the implementation, including +-- but not limited to any warranty or representation that the implementation is free +-- from claims of any third party. Futhermore, Xilinx is providing this core as a +-- courtesy to you and suggests that you contact all third parties to obtain the +-- necessary rights to use this implementation. +-- +------------------------------------------------------------------------------------ +-- +-- Library declarations +-- +-- The Unisim Library is used to define Xilinx primitives. It is also used during +-- simulation. The source can be viewed at %XILINX%\vhdl\src\unisims\unisim_VCOMP.vhd +-- +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; +library unisim; +use unisim.vcomponents.all; +-- +------------------------------------------------------------------------------------ +-- +-- Main Entity for UART_TX +-- +entity uart_tx is + Port ( data_in : in std_logic_vector(7 downto 0); + write_buffer : in std_logic; + reset_buffer : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + buffer_full : out std_logic; + buffer_half_full : out std_logic; + clk : in std_logic); + end uart_tx; +-- +------------------------------------------------------------------------------------ +-- +-- Start of Main Architecture for UART_TX +-- +architecture macro_level_definition of uart_tx is +-- +------------------------------------------------------------------------------------ +-- +-- Components used in UART_TX and defined in subsequent entities. +-- +------------------------------------------------------------------------------------ +-- +-- Constant (K) Compact UART Transmitter +-- +component kcuart_tx + Port ( data_in : in std_logic_vector(7 downto 0); + send_character : in std_logic; + en_16_x_baud : in std_logic; + serial_out : out std_logic; + Tx_complete : out std_logic; + clk : in std_logic); + end component; +-- +-- 'Bucket Brigade' FIFO +-- +component bbfifo_16x8 + Port ( data_in : in std_logic_vector(7 downto 0); + data_out : out std_logic_vector(7 downto 0); + reset : in std_logic; + write : in std_logic; + read : in std_logic; + full : out std_logic; + half_full : out std_logic; + data_present : out std_logic; + clk : in std_logic); + end component; +-- +------------------------------------------------------------------------------------ +-- +-- Signals used in UART_TX +-- +------------------------------------------------------------------------------------ +-- +signal fifo_data_out : std_logic_vector(7 downto 0); +signal fifo_data_present : std_logic; +signal fifo_read : std_logic; +-- +------------------------------------------------------------------------------------ +-- +-- Start of UART_TX circuit description +-- +------------------------------------------------------------------------------------ +-- +begin + + -- 8 to 1 multiplexer to convert parallel data to serial + + kcuart: kcuart_tx + port map ( data_in => fifo_data_out, + send_character => fifo_data_present, + en_16_x_baud => en_16_x_baud, + serial_out => serial_out, + Tx_complete => fifo_read, + clk => clk); + + + buf: bbfifo_16x8 + port map ( data_in => data_in, + data_out => fifo_data_out, + reset => reset_buffer, + write => write_buffer, + read => fifo_read, + full => buffer_full, + half_full => buffer_half_full, + data_present => fifo_data_present, + clk => clk); + +end macro_level_definition; + +------------------------------------------------------------------------------------ +-- +-- END OF FILE UART_TX.VHD +-- +------------------------------------------------------------------------------------ + +