ScoutDavid, I would strongly dissuade you from that; it will make your life harder in the long run, not to mention making it nearly impossible for anyone to help you debug your code. To each his own, though.
KermMartian wrote:
ScoutDavid, I would strongly dissuade you from that; it will make your life harder in the long run, not to mention making it nearly impossible for anyone to help you debug your code. To each his own, though.


I comment most of my hex .db's and .dw's for other people to understand them.

Example:


Code:
.nolist
#include "ti83plus.inc"
.list
   .org userMem-2
   .db $BB,$6D
   
Init:
  B_CALL _ClrLCDFull
  .db $FD,$CB,$00,$AE         ;This disables "Done"
  ld b,5
  ld a,6
 
  ld h,2
  ld l,3
  ld d,4
  ld e,5
 
Beginning_Of_Loop:
  add a,h
  add a,l
  add a,d
  add a,e
  djnz Beginning_Of_Loop
 
  ld h,0
  ld l,a
  B_CALL _DispHL
  B_CALL _getKey
  B_CALL _ClrLCDFull
  ret
KermMartian wrote:
ScoutDavid, I would strongly dissuade you from that; it will make your life harder in the long run, not to mention making it nearly impossible for anyone to help you debug your code. To each his own, though.


I'll add that writing in mnemonics consistently makes it easier to distinguish data from code when you're just "eyeballing" the files, but it also guarantees that you actually understand what you're writing.
For which matter, wouldn't


Code:
  res donePrgm,(iy+doneFlags) ;This disables "Done"

be clearer in the first place? Even without the comment, it's quite easy to look up what those flags mean.
benryves wrote:
For which matter, wouldn't


Code:
  res donePrgm,(iy+doneFlags) ;This disables "Done"

be clearer in the first place? Even without the comment, it's quite easy to look up what those flags mean.


I had no idea FDCB00AE meant, I just learnt Hex first, and got used to it!

a, is it so hard to understand?
I'd say that's the bigger problem then; using code without understanding what it means or how it works is not a very good idea. If you use an opcode table you can disassemble the hex to figure out what it's doing.
benryves wrote:
I'd say that's the bigger problem then; using code without understanding what it means or how it works is not a very good idea. If you use an opcode table you can disassemble the hex to figure out what it's doing.


I'd use a better Z80 Table here. And I can also use Assemblex I type FDCB00AE and I get in real-time the Assembly code disassembled.

However, let's say I was using mimas, I didn't know the res by heart, but I knew FDCB00AE by heart, then I have to use hex.

I use Mimas and TI-84+ Program Editor to code in hex and assembly, since I prefer to waste my computer time to code languages that aren't calculator.

My point being: There's no way you can convince me to fully use menmonics.
ScoutDavid wrote:
a, is it so hard to understand?
Is which so hard to understand, raw hex or mnemonics or ASM in general? I find the res donePrgm,(iy+doneFlags) line to be extremely simple and self-explanatory to people, even if they're not familiar with z80 exactly, whereas ".db $FD,$CB,$00,$AE" (or worse, .dw $CBFD,$AE00) would be almost nothing to almost everyone.
KermMartian wrote:
ScoutDavid wrote:
a, is it so hard to understand?
Is which so hard to understand, raw hex or mnemonics or ASM in general? I find the res donePrgm,(iy+doneFlags) line to be extremely simple and self-explanatory to people, even if they're not familiar with z80 exactly, whereas ".db $FD,$CB,$00,$AE" (or worse, .dw $CBFD,$AE00) would be almost nothing to almost everyone.


It's my code, though. I find hex easier to handle than Assembly.

Why do res blah blah when I can use FDCB00AE? Much simpler.
ScoutDavid wrote:
KermMartian wrote:
ScoutDavid wrote:
a, is it so hard to understand?
Is which so hard to understand, raw hex or mnemonics or ASM in general? I find the res donePrgm,(iy+doneFlags) line to be extremely simple and self-explanatory to people, even if they're not familiar with z80 exactly, whereas ".db $FD,$CB,$00,$AE" (or worse, .dw $CBFD,$AE00) would be almost nothing to almost everyone.


It's my code, though. I find hex easier to handle than Assembly.

Why do res blah blah when I can use FDCB00AE? Much simpler.

How is it simpler? The only reason why hex would be simpler is that you don't have to type as much. Also, if you use hex, you probably won't know what the set and res opcodes actually do (setting or resetting bits).
Indeed, and it makes your code much harder to maintain (and as I said, impossible to show to any other coder). I might be beating a beat horse with this topic, though.
  
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 2 of 2
» 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