Re: A86: Re: [sqrt] program trouble
[Prev][Next][Index][Thread]
Re: A86: Re: [sqrt] program trouble
-----Original Message-----
From: ComAsYuAre@aol.com <ComAsYuAre@aol.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Tuesday, October 06, 1998 7:07 PM
Subject: Re: A86: Re: [sqrt] program trouble
>
>here are some refinements. don't know if they'll help :)
>
>
>#include "ti86asm.inc"
>#include "asm86.h"
>#include "ti86abs.inc"
>
>_exec_basic equ 4c47h ;basic program in OP1
>
>.org _asm_exec_ram
>
> ld hl,$5a92 ;points to [sqrt]key name in memory
> rst 20h ;[sqrt]KEY -> OP1
> rst 10h ;_findsym
> call nc,_delvar ;if prog already exists, delete it
> ld hl, code_end - code_start ;prog length
> call _CREATEPROG ;make program. name already in OP1
> ld a,b ;copy bde
> ex de,hl ;to ahl
> call $4c3f ;ahl += 2
> call _SET_ABS_DEST_ADDR ;set ahl as destination
> xor a ;clear a since ahl is size
> ld hl,code_end - code_start ;size of prog
> call _SET_MM_NUM_BYTES ;set ahl as length
> ld hl,code ;hl points to code (a is already
>0)
> call _SET_ABS_SRC_ADDR ;set ahl as source
> call _mm_ldir ;24 bit ldir
> set 6,(iy+$24) ;enables program
> ret ;quit
>
>code:
>.org _asm_exec_ram-2
>code_start:
>.db $8e,$28 ;define asm token as first prog
bytes
> call $479f ;pop op1 (the calling prog push it)
> bit 4, (iy+18) ;alpha
> ret nz
This is a problem, you don't want to return with the zero flag reset or you
will reorganize the key board matrix. It should be jr nz,End
You also need to get the keypress before you can check it. Asm modules
only return without changing registers.
ld a,($d625)
ret z ;this will speed it up a little, note that the
zero flag is set
> cp K_CLEAR ;don't need to call GET_KEY, this prog is with a key already in
>a
> jr nz,End
> ld hl,Setting
> rst 20h
> rst 10h ;_findsym
> call nc,_exec_basic ;only if program actually exists
>End:
> cp a ;set z flag
> ret ;return
>Setting:
> .db 18,8,"BlitZÉNT" ;add the type byte for _findsym
>code_end:
>.end
>