News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Where there is at the cpc6128 free ram in the zeropage ? Or .....

Started by cpcuser, 09:41, 16 November 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cpcuser

Hi good afternoon.
I want to pass the address of symbols to the asmprogramm.
Where there is at the cpc6128 free ram in the zeropage to put the address there and from the program to then pick up?

Or is there another possibility to pass the address to the asmprogramm?


this is for ccz80++.


thank you.
greeting



include Indirections6128.ccz80++
include Text.ccz80++


class Test
{
  static void main()
  { 
     static short symbole[] = { 0,0,126,195,129,129,195,126, 0,0,0,0,0,36,24,0
      6,8,0,0,0,0,0,0 ,126,66,126,66,126,66,126,066};
     
     symbol();
      Text.Cls();
    Text.PrintString("\n\rtuvw");   
  }
   
   public static void symbol()
   asm
   {
      ld a,115
      call #bbae
      ld de,115
      call #bbab
      ld hl, ??  adresse from symbole[] 
      ld a,116           
      ld b,4   
               
   __sch:
      push af
      push bc
      push hl
      call #bba8     
      pop hl
      ld bc,8                 
      add hl,bc
      pop bc
      pop af
      inc a
      djnz __sch
      ld h,3
      ld l,5
      call #bb75
      ld a,116
      call #bb5a
   ret
   }
}

arnoldemu

C uses the stack for parameters.

e.g.


void symbol(void *symboldata)


Maybe ccz80 does that too?

then in asm do this:


ld hl,#2
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource


arnoldemu

Quote from: cpcuser on 13:16, 16 November 16
hello, thanks.


greeting

ccz80++ in Graphics.ccz80++ (a C++ function with inline asm).


  public static void Origin(int argument1, int argument2)
    asm (Indirections.Values())
    {
      ld   hl,2                  ;;; <<<< return address from ret
      add  hl,sp             ;; <<< parameters on stack
      ld   e,(hl)               ;; << argument2 in de (parameters in reverse)
      inc  hl
      ld   d,(hl)                           
      inc  hl
      ld   a,(hl)               ;; << argument1 in hl
      inc  hl
      ld   h,(hl)
      ld   l,a                                ; HL = 1st parameter
      ex   de,hl                              ; DE = x, HL = y
      jp   __gra_set_origin
    }


Yes if you make asm code and use winape, then use the stack.

extern static void myFunction(int param1, int param2);


in asm:


__myFunction:   ;;; <<< check map/list for function name
   ld   hl,2                  ;;; <<<< return address from ret
      add  hl,sp             ;; <<< parameters on stack
      ld   e,(hl)               ;; << argument2 in de (parameters in reverse)
      inc  hl
      ld   d,(hl)                           
      inc  hl
      ld   a,(hl)               ;; << argument1 in hl
      inc  hl
      ld   h,(hl)
      ld   l,a                                ; HL = 1st parameter
...
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

ccz80++ manual. English. Page 21 "Using assembler" describes parameters.

It doesn't say about map or listing. I hope asm file has label in it.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

cpcuser


Powered by SMFPacks Menu Editor Mod