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.
Z80 & 68k Assembly =>
z80 & ez80 Assembly
Author |
Message |
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 29 Jul 2003 11:06:00 am Post subject: |
|
|
How do you search a program in the RAM ? (I'd just like to have the address of the first byte in HL).
Here is what I did :
Code: ld hl, prog
RST 20h ; copie dans OP1
RST 10h ; "look it up"
jp c, exit ; si programme absent
ld hl, $AA4C - $9d95 + 4 ; adresse du Highscore (DE+$CBB)
add hl, de
prog .db 06, "SERPENT2", 0 ;06 = Protected Program
Some additional comment :
I use 06h = ProtObjPrgm instead of 05h = ObjPrgm (or something like that) because SERPENT2 is an asm compiled program (--> Hidden)
I'm not forced to put à 0 after the name of the program because it is 8 characters long.
$AA4C is the address of the byte I'de like to change. I've found it in the .lst file, so the first address is 9d95h, where the program starts. I must substract it. The 4 other bytes are for the AsmComp tokens, or something like that. Well, I've found them in the 28days tutorial.
I don't know whether I must add $8000 bytes, as RST 10h look it up in the RAM (which starts at this address).
I add DE to HL, because the address of the first byte is stored in DE when we do RST 10h
Now, I would be surprised if anyone found what's wrong in my code... Remember that the purpose of this code is to put HL on the byte I'd like to change, which is in the program SERPENT2.
I hope you'll found but I think I'm disguted now... = burps |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 29 Jul 2003 11:25:16 am Post subject: |
|
|
ok, i see a problem right off the bat... u shouldnt use rst 10h to find the first byte of a prgm... u should use bcall(_ChkFindSym) it finds prgms... then it puts the first value in DE which u must increment 2 times to get past the 2 size bytes... also, if ur program is hidden, then u need to check through the symbol table for the name i think but not sure, cause i havent used hidden progs in programming much... |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 29 Jul 2003 12:32:20 pm Post subject: |
|
|
Ok the first thing you would want to do is get how many bytes are between the starting point of your program and the label.(SERPENT2 is the program you need to find this out in) Then Simply
Code: ld hl,progname
rst 20h
bcall(_chkfindsym)
ld a,b
or a
ret nz;if program is archived quit
ld hl,$0000[SIZE=1];<---fill this with bytes in between start of program and label including the $BB,$6D
[/SIZE]
add hl,de
;do whatever you want now.
progname:
.db $05,"SERPENT2",0
Now hl points to the address you want.
Last edited by Guest on 29 Jul 2003 12:34:10 pm; edited 1 time in total |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 29 Jul 2003 12:47:36 pm Post subject: |
|
|
When I use it, it finds the program at the address $9FA1. Is that possible ?
And then, when I try displaying the value, I've got an error : OVERFLOW.
You see what's the problem ?
Justin W. : That's exactly what I did Thanks anyway
Last edited by Guest on 29 Jul 2003 12:49:35 pm; edited 1 time in total |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 29 Jul 2003 01:12:02 pm Post subject: |
|
|
Quote: When I use it, it finds the program at the address $9FA1. Is that possible ?
It seems to because it works now
Quote: I've got an error : OVERFLOW
Always the same bug : DispOP1a generates this error when OP1 = 0. In Fact, I've been confused by day 24 of the tutorials : the author adds 4 bytes in his code (and it's what we must do), but in the program I want to do, I just have to add 2 bytes (because of $BB,$6D as said Justin)
Quote: That's exactly what I did
Well in fact I did not add the right number of bytes. But I did the code with _ChkFindSym as said Adm.Wiggin before you
thanks to you all
The program I'm doing is a kind of "patch" for the well-known program "SERPENT2". In the new version, you'll be able to put the Highscore to 1 (not 0 because there is an error : overflow), and what's more, I'll add another version, entirely in English ! yahooo ! |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 29 Jul 2003 01:35:26 pm Post subject: |
|
|
The reason he adds 4 bytes is he is bypassing the size bytes and the AsmPrgm Token. |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
|
Back to top |
|
|
|
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