I am a burgeoning z80 asm programmer, and for educational purposes I thought I would try writing the source code of a file I found in a tutorial without including ti83plus.inc. With the include file, the code looks like this:

Code:
#include    "ti83plus.inc"
.org    $9D93
.db    t2ByteTok, tAsmCmp
   
keyloop:
   b_call(_GetCSC)
   
   cp skenter   ;if Enter was pressed, end loop
   jr z,endloop
   
   cp sk2nd   ;if 2nd was pressed, end loop
   jr z,endloop
   
   jr keyloop   ;if somthing else was pressed, loop back

endloop:
   ret

.end


Its purpose to create a while loop with a getKey inside, and the loop will only end when 2nd or Enter is pressed. Here is my attempt at writing the code without the #include statement:

Code:
#define b_call(xxxx)     rst 28h         \ .dw xxxx
_GetCSC      EQU 4018h
skEnter         EQU 09h
sk2nd           EQU 36h
t2ByteTok       EQU 0BBh
tasmCmp    EQU 6Dh

.org    $9D93
.db    t2ByteTok, tAsmCmp
   
keyloop:
   b_call(_GetCSC)
   
   cp skenter   ;if Enter was pressed, end loop
   jr z,endloop
   
   cp sk2nd   ;if 2nd was pressed, end loop
   jr z,endloop
   
   jr keyloop   ;if somthing else was pressed, loop back

endloop:
   ret

.end


Now I know that the first file can be run seamlessly on my WabbitEmu emulator, but the second file won't even assemble, and I get the error message "Error: Instruction '4018h' not understood. [zztemp.asm:3]" when assembling with the Doors CS Assembler/Compiler. Any ideas what I am doing wrong?
Either use .equ instead of EQU, or add a #define EQU .equ at the very beginning of the file. EQU is not a real command to the assembler, where .anything is a proper assembler command. There's no real point in trying to memorize all of the equates, though. Smile
wow, Mr. Martian you are good; it works! But why does TI bother creating the "EQU" and "equ" macros anyway, if all they do is save one dot in the code...
When you're working with low-storage devices like TI devices, anything you can do to be more efficient benefits you greatly.
techboy6601 wrote:
When you're working with low-storage devices like TI devices, anything you can do to be more efficient benefits you greatly.
Assembly source code isn't stored on the calculator itself (basically until OTBP Assembler and Mimas, which I highly doubt anyone at TI has ever used). So I guess it was to save people from typing that hard-to-reach key.

On the other hand, there may be assemblers that don't use dots before directive names (assembler syntax is far from standardized Razz), and TI engineers may have been accustomed to that.
Deep Thought wrote:
techboy6601 wrote:
When you're working with low-storage devices like TI devices, anything you can do to be more efficient benefits you greatly.
Assembly source code isn't stored on the calculator itself (basically until OTBP Assembler and Mimas, which I highly doubt anyone at TI has ever used). So I guess it was to save people from typing that hard-to-reach key.

On the other hand, there may be assemblers that don't use dots before directive names (assembler syntax is far from standardized Razz), and TI engineers may have been accustomed to that.
The EQU is a throwback from an assembler that preceded TASM. When we started writing code in the community, instead of find-replacing every EQU with .equ, we just tossed the #define EQU .equ at the top of include files. And techboy, that's wrong, as since Deep said, the assembler directives don't touch your calculator.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement