This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
b__


Member


Joined: 16 Jun 2003
Posts: 173

Posted: 12 Jul 2003 08:51:32 pm    Post subject:

How do u display the size of a program? I know that the first two bytes are for the size, the first is the most significant byte, the second is the lsb, but i don't know what the msb and lsb are.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 12 Jul 2003 10:23:27 pm    Post subject:

have u tried this (comes right after chkfindsym) :
Code:
     ld hl,(de)
    bcall(_DispHL)
? it should work fine...
Back to top
CoBB


Active Member


Joined: 30 Jun 2003
Posts: 720

Posted: 13 Jul 2003 12:11:58 am    Post subject:

That won't compile. You can't do "ld hl,(de)".
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 13 Jul 2003 01:18:58 am    Post subject:

Adm.Wiggin wrote:
have u tried this (comes right after chkfindsym) :
Code:
     ld hl,(de)
    bcall(_DispHL)
?  it should work fine...

As Cobb already stated ld hl,(de) is in invalid z80 instruction. If you wanted to get the size of the program into hl and display it, you would have to

Note: All of the code in the examples are to proceed after bcall(_chkfindsym)

Code:
  ex de,hl
  ld e,(hl)
  inc hl
  ld h,(hl) ;I have not used this instruction but it is a valid z80 instruction
  ld l,e
  bcall(_disphl)


One problem, this code would destroy both pointers, the one to the vat entry, and the one to the programs data.

Now to save at least one of your pointers


Code:
  ex de,hl;switch pointers de=vat entry, hl=program data
  ld e,(hl)
  inc hl
  ld d,(hl)
  inc hl
  ex de,hl;switch pointers de=beginning of actual program data, hl=size
  push de;save pointer
  bcall(_disphl)
  pop de;restore pointer


Now you still have the pointer to the program data only it's been moved past the two size bytes and onto the first byte of the actual program data. The flash page is also is still in tact as none of the instructions modify the b register.


Last edited by Guest on 13 Jul 2003 01:24:16 am; edited 1 time in total
Back to top
b__


Member


Joined: 16 Jun 2003
Posts: 173

Posted: 13 Jul 2003 03:28:01 pm    Post subject:

Wouldnt that display hl in hex? I was thinking more like


;(right after chkfindsym)
ex de,hl
ld e,(hl)
inc hl
ld h,(hl)
ld l,e
bcall(_SetXXXXOP2) ;loads hl into op2
bcall(_OP2ToOP1) ;loads op2 into op1
bcall(_DispOP1A) ;displays op1 rounded to A amount of digits

Is this all right? I haven't tested it yet.
Back to top
Tyraniek


Member


Joined: 07 Jun 2003
Posts: 133

Posted: 13 Jul 2003 04:25:11 pm    Post subject:

Quote:
bcall(_DispOP1A) ;displays op1 rounded to A amount of digits

I think it displays A rounded to OP1 amount of digits.
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 13 Jul 2003 05:09:45 pm    Post subject:

b__ wrote:
Wouldnt that display hl in hex?  I was thinking more like


;(right after chkfindsym)
ex de,hl
ld e,(hl)
inc hl
ld h,(hl)
ld l,e
bcall(_SetXXXXOP2) ;loads hl into op2
bcall(_OP2ToOP1)      ;loads op2 into op1
bcall(_DispOP1A)      ;displays op1 rounded to A amount of digits

Is this all right? I haven't tested it yet.

No you are wrong about that. The rom call bcall(_Disphl) displays the number in decimal format, and no matter what it will take 5 character spaces.
Back to top
b__


Member


Joined: 16 Jun 2003
Posts: 173

Posted: 13 Jul 2003 09:35:21 pm    Post subject:

Oh. Thanks a lot.
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 14 Jul 2003 11:14:07 am    Post subject:

with the 5 spaces thing, if the number was 567 then it would display (space)(space)567... just fyi...
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement