Re: A82: ASM code problem
[Prev][Next][Index][Thread]
Re: A82: ASM code problem
In a message dated 97-07-07 22:26:05 EDT, you write:
<< At 07:54 PM 7/7/97 -0400, you wrote:
>> call (FINAL_ADDR)
>
>Well... CALL (FINAL_ADDR) should mean call the address that's stored at
'FINAL_ADDR', but that's not an instruction in Z80 assembly language, so
I'm assuming it's supposed to be CALL_(FINAL_ADDR), which is the
Zshell/Ash/Oshell-82 defines for calling even though the program will be at
another place.
No, I meant call (FINAL_ADDR). The call opcode does exist (see the Z80
Instruction Set Summary). The source I sent to this list is only a small
portion of the ROM_CALL routine that I will be using in ASH <-> OShell. I
sent the source because I wanted to see if there was any errors in my
knowledge of Z80 ASM. I have narrowed my problem down to just a line or
two of code. The following code does NOT work:
#include "ti-82.h"
FINAL_ADDR = $8C2B ; Word
.ORG 0
.DB "Test Ver",0
call CLEARLCD ; Clears the LCD
ld bc,0 ; 0 -> c, 0 -> b
ld (CURSOR_ROW),bc ; Set cursor at position (0,0)
ld hl,Text ; Address of Text -> hl
ld de,(PROGRAM_ADDR) ; (PROGRAM_ADDR) -> de
add hl,de ; hl = hl + de
ld bc,D_ZT_STR
ld (FINAL_ADDR),bc
call (FINAL_ADDR)
GetkeyLoop:
call GET_KEY ; Get the keyboard scan code
cp $37 ; Check to see if [MODE] was pressed
ret Z ; If so, return to caller
jr GetkeyLoop ; Goto GetkeyLoop
Text: .DB "Hello World!!!",0
.END
However, this code works (it gets to be REAL weird after fooling with the
code for a while):
#include "ti-82.h"
FINAL_ADDR = $8C2B ; Word
.ORG 0
.DB "Test Ver",0
call CLEARLCD ; Clears the LCD
ld bc,0 ; 0 -> c, 0 -> b
ld (CURSOR_ROW),bc ; Set cursor at position (0,0)
ld hl,Text ; Address of Text -> hl
ld de,(PROGRAM_ADDR) ; (PROGRAM_ADDR) -> de
add hl,de ; hl = hl + de
call D_ZT_STR
GetkeyLoop:
call GET_KEY ; Get the keyboard scan code
cp $37 ; Check to see if [MODE] was pressed
ret Z ; If so, return to caller
jr GetkeyLoop ; Goto GetkeyLoop
Text: .DB "Hello World!!!",0
.END
Both programs should be compiled under OShell-82. This is a very confusing
problem and I really would like any hint to an answer.
>>
ever heard of a ROM_CALL? call CLEARLCD should not work, and niether should
call D_ZT_STR (and of course not that junk in the first program!!!)
but yes, call does exist.
~Adamman