Hi good afternoon.
I would the 0xc000 from addr to hl.
what is wrong there please?
the value x is passed.
thanks.
greeting
#include <cpctelera.h>
u8 x;
u16 addr;
void datascr() {
__asm
ld a,#_x
ld hl,#_addr
ld(hl),a
__endasm;
}
int main() {
cpct_disableFirmware();
cpct_setVideoMode(2);
x=255;
addr=0xc000;
datascr();
while(1);
}
You are loading the address of x into the A register.
how do i get this 0xc000 from addr in hl?
thanks.
Please, stop tagging as "cpctelera" questions that have nothing to do with CPCtelera.
This is an assembly question, and should go into the assembly programming forum, more precisely into a newbie corner.
@Gryzor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=1).
How about "native C" ?
#include <cpctelera.h>
int main() {
u8 x;
u16* addr;
cpct_disableFirmware();
cpct_setVideoMode(2);
x=255;
addr=0xc000;
*addr=x;
while(1);
}
That addr should be a pointer to byte, not to word; isn't it?
u8 *addr;
addr = (u8 *)0xc000;
*addr = 255;
EDIT: OK, mode 2. May be you did it on purpose!
Quote from: ronaldo on 15:31, 16 December 20
Please, stop tagging as "cpctelera" questions that have nothing to do with CPCtelera.
This is an assembly question, and should go into the assembly programming forum, more precisely into a newbie corner.
@Gryzor (https://www.cpcwiki.eu/forum/index.php?action=profile;u=1).
Do we have an assembly subforum? :D
Quote from: Gryzor on 08:48, 17 December 20
Do we have an assembly subforum? :D
Does 'Listings' in the 'Deutsches CPC-Forum' qualify? :-X
Quote from: Gryzor on 08:48, 17 December 20
Do we have an assembly subforum? :D
I think I got carried away and imagined forums and subforums in my own parallel reality ::) .
Anyway, a newbie assembly corner could be useful.
Quote from: ronaldo on 13:39, 17 December 20I think I got carried away and imagined forums and subforums in my own parallel reality
We all do from time to time, nothing to worry about.
Quote from: ronaldo on 13:39, 17 December 20Anyway, a newbie assembly corner could be useful.
As always, if more people find it a good idea I'll be more than happy to add whatever!
Quote from: AMSDOS on 09:59, 17 December 20
Does 'Listings' in the 'Deutsches CPC-Forum' qualify? :-X
No, "Listings" is for type-in stuff.
How about "https://www.cpcwiki.eu/forum/programming/asm-source-code/" ?
hello, thanks for the help.
greeting.
Quote from: SRS on 20:56, 17 December 20
How about "https://www.cpcwiki.eu/forum/programming/asm-source-code/" ?
That's a thread though, not a forum?
You can add some C code into your asm function (param+=1) and see the .asm file resulting. Like a hacker 8)
void toto(unsigned char c) {
__asm
TADA
__endasm;
c=c+1
}
Quote from: Gryzor on 08:41, 18 December 20
That's a thread though, not a forum?
We need a forum about "What's a forum, a subforum and a thread for newbies ...." ! 8)
Quote from: SRS on 20:56, 18 December 20
We need a forum about "What's a forum, a subforum and a thread for newbies ...." ! 8)
Surely you mean a topic? 😂