[Coco] strange behaviour

Robert Gault robert.gault at worldnet.att.net
Wed Jun 16 07:48:17 EDT 2004


James Dessart wrote:
> The following assembly routine, to my knowledge, should return the value 
> of POLCAT in the D register. For some reason, it's not returning at all. 
> Can anyone provide some insight?
> 
> _getch:
>     ldb    ___ungetched_char
>     beq    read_key
>     clra
>     sta    ___ungetched_char
>     rts
> read_key:
>     pshs    y
> loop:   
>     jsr    [0xA000]  ; call POLCAT
>     tfr    a,b
>     clra
>     puls    y,pc
> 
> Thanks,
> James
> 
> 

If the above is the only place where $A000 is invoked, you will have 
problems. Also, $A000 does not change regY. For example:

_getch:    This gets the key in regD and clears the cache.
     ldb    ___ungetched_char
     beq    read_key
     tfr    a,b
     clra
     sta    ___ungetched_char
     rts
read_key:   This keeps POLCAT the "same" but preserves the key value
     jsr    [0xA000]  ; call POLCAT
     sta     _ungetched_char
     rts




More information about the Coco mailing list