// Program to test, if we can transfer a subroutine to // the H8/3292 on-chip RAM and run it there. // the program disable all peripherical devices. label begin_of_program //WAIT 500ms mov.w #0x1F4,r1 label L_sys_1002 subs #0x1,r1 mov.w #0X294,r2 label L_sys_1003 subs #0x1,r2 mov.w r2,r2 bne L_sys_1003 mov.w r1,r1 bne L_sys_1002 label begin_of_task_0 //clear user memory mov.w #0xcc40,r0 mov.w #0xF000,r1 jsr @0x436 //start initialization //define array //segment_address_array //define array //segment_bit_array //define array //TEXT // SV_DISPLAY_UPDATE_MOTOR = -1 mov.b #0xFF,r6L mov.b r6L,@0xCC8B // SV_VIEW = 255 mov.b #0xFF,r6L mov.b r6L,@0xCC8C //define array //sub_addresses jsr init_sub_address_list mov.w #0x4D2,r6 //display value in r6 mov.w #0x3002,r5 mov.w r5,@-r7 mov.w r6,@-r7 mov.w #0x3001,r6 jsr @0x1ff2 mov.w @r7+,r6 adds #0x2,r7 //ROM_CALL jsr @0x27C8 mov.w #0xFDC0,r6 mov.w begin_of_sub_snooze,r5 mov.b #0x50,r4L eepmov 0 //WAIT 5000ms mov.w #0x1388,r1 label L_sys_1006 subs #0x1,r1 mov.w #0X294,r2 label L_sys_1007 subs #0x1,r2 mov.w r2,r2 bne L_sys_1007 mov.w r1,r1 bne L_sys_1006 jmp @0xfdc0 //disable orc #0x80 //WAIT 500ms mov.w #0x1F4,r1 label L_sys_1008 subs #0x1,r1 mov.w #0X294,r2 label L_sys_1009 subs #0x1,r2 mov.w r2,r2 bne L_sys_1009 mov.w r1,r1 bne L_sys_1008 //reset RCX jsr @@0x0 label end_of_task_0 //if we ever came here jmp end_of_task_0 //sub snooze label begin_of_sub_snooze mov.b @0xffba,r6L or #0x4,r6L mov.b r6L,@0xffba //WAIT 30000ms mov.w #0x7530,r1 label L_sys_1004 subs #0x1,r1 mov.w #0X294,r2 label L_sys_1005 subs #0x1,r2 mov.w r2,r2 bne L_sys_1005 mov.w r1,r1 bne L_sys_1004 mov.b @0xffba,r6L and #0xfb,r6L mov.b r6L,@0xffba mov.w #0x10E1,r6 //display value in r6 mov.w #0x3002,r5 mov.w r5,@-r7 mov.w r6,@-r7 mov.w #0x3001,r6 jsr @0x1ff2 mov.w @r7+,r6 adds #0x2,r7 //ROM_CALL jsr @0x27C8 label lab_100_0 jmp lab_100_0 //end_of_sub_snooze rts 0 label init_sub_address_list // SYS_TICKS = 165 mov.w #0xA5,r6 mov.w r6,@0xCCA4 // NUMBER_OF_NON_BGH_TASKS = 1 mov.w #0x1,r6 mov.w r6,@0xCCA6 // LAST_NUMBER_OF_NON_BGH_TASKS = 1 mov.w #0x1,r6 mov.w r6,@0xCCA8 rts 0 label sys_recalculate_sys_ticks // TMP_SYS_TICKS_L_321 = SYS_TICKS mov.w @0xCCA4,r6 mov.w r6,@0xCCAA //TMP_SYS_TICKS_L_321 =TMP_SYS_TICKS_L_321 * LAST_NUMBER_OF_NON_BGH_TASKS mov.w @0xCCA8,r5 mov.w @0xCCAA,r6 jsr @0x0130 mov.w r6,@0xCCAA //TMP_SYS_TICKS_L_321 =TMP_SYS_TICKS_L_321 * 10 mov.w #0xA,r5 mov.w @0xCCAA,r6 jsr @0x0130 mov.w r6,@0xCCAA //TMP_SYS_TICKS_L_321 =TMP_SYS_TICKS_L_321 / NUMBER_OF_NON_BGH_TASKS mov.w @0xCCA6,r5 mov.w @0xCCAA,r6 jsr @0x01be mov.w r6,@0xCCAA //TMP_SYS_TICKS_L_321 =TMP_SYS_TICKS_L_321 + 5 mov.w #0x5,r5 mov.w @0xCCAA,r6 add.w r5,r6 mov.w r6,@0xCCAA //TMP_SYS_TICKS_L_321 =TMP_SYS_TICKS_L_321 / 10 mov.w #0xA,r5 mov.w @0xCCAA,r6 jsr @0x01be mov.w r6,@0xCCAA //IF TMP_SYS_TICKS_L_321 <= 32767 mov.w #0x7FFF,r5 mov.w @0xCCAA,r6 cmp.w r5,r6 bls true_1010 // TMP_SYS_TICKS_L_321 = 32767 mov.w #0x7FFF,r6 mov.w r6,@0xCCAA label true_1010 //IF TMP_SYS_TICKS_L_321 >= 1 mov.w #0x1,r5 mov.w @0xCCAA,r6 cmp.w r5,r6 bcc true_1011 // TMP_SYS_TICKS_L_321 = 1 mov.w #0x1,r6 mov.w r6,@0xCCAA label true_1011 // SYS_TICKS = TMP_SYS_TICKS_L_321 mov.w @0xCCAA,r6 mov.w r6,@0xCCA4 // LAST_NUMBER_OF_NON_BGH_TASKS = NUMBER_OF_NON_BGH_TASKS mov.w @0xCCA6,r6 mov.w r6,@0xCCA8 rts 0 //sub sys_wait_hundredth_new label sys_wait_hundredth_new //HUNDREDTH =HUNDREDTH * 10 mov.w #0x0,r3 mov.w #0xA,r4 jsr @0x01fe jsr sys_type_cast_I32_to_U32 jsr sys_wait_ms_new //end_of_sub_sys_wait_hundredth_new rts 0 //sub sys_wait_ms_new label sys_wait_ms_new //make room for stack variables mov.w #0x6,r0 sub.w r0,r7 mov.w r6,@(0x0,r7) // WAIT_TIME1_ST_300 = 0 mov.w #0x0,r6 mov.w r6,@(0x2,r7) label beginloop_3002 IF WAIT_TIME1_ST_300 < MS_ST_300 mov.w @(0x0,r7),r5 mov.w @(0x2,r7),r6 cmp.w r5,r6 bcs fordo_3002 jmp endloop_3002 label fordo_3002 adds #0x1,r6 mov.w r6,@(0x2,r7) // WAIT_TIME2_ST_300 = 0 mov.w #0x0,r6 mov.w r6,@(0x4,r7) label beginloop_3005 IF WAIT_TIME2_ST_300 < SYS_TICKS mov.w @0xCCA4,r5 mov.w @(0x4,r7),r6 cmp.w r5,r6 bcs fordo_3005 jmp endloop_3005 label fordo_3005 adds #0x1,r6 mov.w r6,@(0x4,r7) jmp beginloop_3005 label endloop_3005 jmp beginloop_3002 label endloop_3002 //free stack variable space mov.w #0x6,r0 add.w r0,r7 //end_of_sub_sys_wait_ms_new rts 0 //CAST i32 to u32 //result in r5r6 label sys_type_cast_I32_to_U32 btst #7,r5H beq sys_ty_ca_I32_U32_1 //negative mov.w #0x0,r5 mov.w #0x0,r6 label sys_ty_ca_I32_U32_1 rts 0 label end_of_program