SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices SetVirtualResolution( 1024, 768 ) // doesn't have to match the window SetWindowAllowResize( 1 ) // allow the user to resize the window When AppGameKit loads the plugin it looks for a function 'ReceiveAGKPtr', this function is called by the runtime and sends the full set of function pointers to the plugin, we will setup this function but not use it yet, this function must exist for the plugin to work so we set this us with a C prototype If everything is good, we can add some code, if something went wrong, check each step and try again. ![]() Pop ) // Shove the function into a lambda function.SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery Mov r0,#STDOUT code to write to the standard output Linux Ldrb r1, read octet start position + indexīne 1b and so here r2 contains the length of the message * r0 contains the address of the message */ ![]() ![]() Sublt r2,#1 if negative sub 1 seconde to secondesĪddlt r3,r1 and add 1000000 to microsecondes number * Procedure for measuring the execution time of a routine */īlx r4 call of the function to be measuredīge 2b loop if not r0,iAdrdwFin end time area ![]() for 11.0592MHz): Note: 1 machine cycle takes 12 oscillator periods 11.0592MHz / 12 * 0.0625 seconds = 57,600 cycles = e100h ffffh - e100h = NOT e100h = 1effh assuming a 11.0592MHz crystal TIMERH EQU _110592H TIMERL EQU _110592L some timer macros (using timer0) start_timer macro setb tr0 endm stop_timer macro clr tr0 endm reset_timer macro mov tl0, #TIMERL mov th0, #TIMERH endm increment_counter macro increment counter (multi-byte increment) push psw push acc push 0 r0 mov r0, #TEND+1 setb c inc_reg: dec r0 clr a addc a, r0 mov r0, a jnc inc_reg_ end prematurally if the higher bytes are unchanged cjne r0, #TSTART, inc_reg inc_reg_: if the carry is set here then the multi byte value has overflowed pop 0 pop acc pop psw endm ORG RESET jmp init ORG TIMER0 jmp timer_0 timer_0: interrupt every 6.25ms stop_timer we only want to time the function reset_timer increment_counter start_timer reti init: mov sp, #TEND setb ea enable interrupts setb et0 enable timer0 interrupt mov tmod, #01 h timer0 16-bit mode reset_timer reset timer counter registers clr a mov r0, #TSTART clear: mov r0, a inc r0 cjne r0, #TEND, clear start_timer call function the function to time stop_timer at this point the registers from TSTART through TEND indicate the current time multiplying the 8/16/24/etc length value by 0.0625 (2^-4) gives the elapsed number of seconds e.g. TC EQU 8 number of counter registers TSTART EQU 08 h first register of timer counter TEND EQU TSTART + TC - 1 end register of timer counter Note: The multi-byte value is stored in Big-endian Some timer reloads _6H EQU 085 h 6MHz _6L EQU 0 edh _12H EQU 00 bh 12MHz _12L EQU 0 dbh _110592H EQU 01 eh 11.0592MHz _110592L EQU 0 ffh How to calculate timer reload (e.g.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |