Re: A86: Inferred timing...Help!!
[Prev][Next][Index][Thread]
Re: A86: Inferred timing...Help!!
At 06:48 PM 10/9/97 -0400, you wrote:
>> the linkport has two data lines. How do you want them to flicker? Tell me
>> that and I'll do it.
>
>I made some code that fickers both the white and red lines on and off at
>the same time. I only need you to help me optimize it. While run this
>code I'm going to hook the linkport up to a osciscope (whatever, I cant
>spell) to determine the fastest the linkport can run under asmbly. With
>this information I'll be able to make an inferred link that will funtion
>under fast transfer asmbly programs. See if you can find anyway to
>optimize this code for speed:
> -Michael
>#include "asm86.h"
>#include "ti86asm.inc"
>
>.org _asm_exec_ram
>
> call _clrLCD
> ld hl,$0000
> ld (_curRow),hl
> ld hl,title
> call _puts
> ld c, $07
>Port_loop:
> ld b, $FC
> out (c),b
> ld b,$C0
> out (c),b
> jp keyloop
>
>keyloop:
> call $5371
> cp $37
> jr z,quit
> jp Port_loop
>
>quit:
> ld b,$C0
> out (c),b
> ret
>
>title:
> .db " "
> .db " Michael Malluck's "
> .db " PortTest "
> .db " V 2.5 "
> .db " "
> .db " Press exit to exit ",0
>
>
>.END
>.END
>.END
Yeah, this can be optimized.
this is just the loop part:
Loop:
ld a,$FC ;these two lines put out $FC to link
out (7),a
ld a,%00111111 ;this is the mask for the keycheck
out (1),a ;put iot out keypad port
ld a,$C0 ;now we switch link port
nop
nop
nop
nop ;to make the timing between the switches more
;equal
out (7),a ;back to what it was
in a,(1) ;now check key
bit 6,a ;this checks for exit
ret nz ;return to TI-os
jr Loop
7+11+7+4+4+4+4=41 ;after first switch (t-states)
11+8+5+12+7=43 ;after second switch (t-states)
this is probably the best possible routine. If you ever are hoping to get
good time out of anything, don't call $5371, or call GET_KEY Neither do
you want to call _getKey.
Those are both bottlenecks and will slow everything down.
The keycheck works, trust me on that, if you want to know how, i'll tell
you later.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Alan Bailey mailto:bailela@charlie.cns.iit.edu
IRC:Abalone Web:http://www.iit.edu/~bailela/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
References: