News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

poke for sdcc poke(int a, char b) ?

Started by funkheld, 09:36, 15 July 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld


Hi good afternoon.
I found this spoke.
how can you make poke (a, b) of it
a = 0xc000 and b = 129.

then how does a peek please?

it is sdcc.

thank you.
greeting

H

it is
thank you.
greeting

void poke(int a) {
__asm
  ld h,5(ix)
  ld l,4(ix)
  ld (hl),#129
__endasm;


}


void main() {
   int addr;
  char s;
   for (addr=0xc000;addr<0xffff;addr++) {
    s= 128;
      poke(addr);
   }
}

pelrun

The same way you write to any address in C, via pointers.
unsigned char *ptr;

ptr = 0xc000;
*ptr = 129;
printf("read from 0xc000: %d", *ptr);

Sykobee (Briggsy)

It looks like a screen clear routine - I'd put a screen clear routine entirely in ASM (e.g., using the stack clear method - Save SP, Change SP to FFFF, PUSH * 16K of the value you want, restore SP).


But in plain C just use pointers as pelrun says - but that won't compile to the fastest screen clear code.

funkheld

hello, thanks for info.


greetring

Powered by SMFPacks Menu Editor Mod