News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

TAG() not function in sdcc for cpc

Started by funkheld, 22:27, 15 July 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld


hello, good day.

hallo, good day.
tag() for move(100,100) not funktion in sdcc for cpc.

can you help please.


tanks
greeting


#include <stdio.h>


void Cls()
{
__asm 
  call #0xBB6C
__endasm; 
}


void Tag()
{
  __asm
  ld   a,#0xFF
  call #0xBB63
  __endasm;
}


void Mode(unsigned char nMode)
{
   __asm
      ld a, 4 (ix)
      call #0xBC0E ;SCR_SET_MODE
   __endasm;
}


void Move(unsigned char *xadr,unsigned char *yadr)
{
   __asm
      LD E, 4(IX)
      LD D, 5(IX)
      LD H, 6(IX)
    LD L, 7(IX)
    call #0xBBC0
   __endasm;
}


void Printc(unsigned char nMode)
{
   __asm
      ld a, 4 (ix)
      call #0xBB5A
   __endasm;
}


void main()
{
   Mode(1);
  Tag();
  Move(100,100);
  Printc(65);
 
   //KM_WAIT_CHAR   
   __asm
      call #0xBB06
   __endasm;   
}

AMSDOS

Seems to work fine for me from my Machine Code routine in BASIC.



100 MODE 1
110 MEMORY &7FFF
120 FOR a=&8000 TO &801F
130   READ a$
140   POKE a,VAL("&"+a$)
150 NEXT a
160 FOR a=0 TO 255:POKE &8006,a:CALL &8000:NEXT a
170 END
1000 DATA 3E,FF,CD,63,BB,21,64,00
1010 DATA EB,21,64,00,CD,C0,BB,3E
1020 DATA 01,CD,DE,BB,3E,E9,CD,5A
1030 DATA BB,C9,00,00,00,00,00,00





The assembly looks like this:



org &8000


ld a,&ff
call &bb63
ld hl,100
ex hl,de
ld hl,100
call &bbc0
ld a,1
call &bbde
ld a,233
call &bb5a
ret



In the past I've used GRA_WR_CHAR &BBFC, which draws the character (stored in A) at a graphical position, the only difference being the need to specify the character number for A. TXT_SET_GRAPHIC (&BB63) needs an input too, but only in the capacity of Switching Graphic Draw On/Off with a Non-Zero/Zero approach, which is what your code has and then print using TXT_OUTPUT.
So I'm unsure why it's not working, has Firmware being disabled perhaps? I guess if MODE isn't working that would be a clue or if the Screen wasn't clearing.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

funkheld

hello thanks.


this not funktion in the sdcc:
ex hl,de

greeting





void Tag()
{
__asm
ld a,#0xFF
call #0xBB63
ld hl,#100
ex hl,de
ld hl,#100
call #0xBBC0
ld a,#1
call #0xBBDE
ld a,#233
call #0xBB5A
__endasm;
}

ervin

I think it's meant to be
EX DE,HL

AMSDOS

It's a bad habit of mine because the Winape Assembler accepts either 'ex hl,de' or 'ex de,hl'.  :picard:
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

funkheld


Hi good afternoon.

tag-move-printc are not yet working together.
it doesn't work with sdcc.
is probably a peculiarity of sdcc.
the ascii is not moving.

thank you.
greeting

AMSDOS

#6
Quote from: funkheld on 15:45, 16 July 20
Hi good afternoon.

tag-move-printc are not yet working together.
it doesn't work with sdcc.
is probably a peculiarity of sdcc.
the ascii is not moving.

thank you.
greeting



Sorry, I don't know sdcc all that well, have you tried it with the leading '0x', the first ld instruction follow by the call to bb63 has one, so perhaps to the others are necessary too?



void Tag()
{__asm
ld a,#0xFF
call #0xBB63
ld hl,#0x100
ex de,hl
ld hl,#0x100
call #0xBBC0
ld a,#0x1
call #0xBBDE
ld a,#0x233
call #0xBB5A
__endasm;}
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

ervin

#7
It has to be more like this:

void Tag()
{
__asm
ld a,#0xFF
call #0xBB63
ld hl,#100
ex de,hl
ld hl,#100
call #0xBBC0
ld a,#1
call #0xBBDE
ld a,#233
call #0xBB5A
__endasm;
}

EDIT: sorry, having issues with code tags in the forum editor!

funkheld


Hi good afternoon.
I can not do it.
that's the program.

I got lost and can't get to my destination.

who knows about it in sdcc please.

thank you.
greeting



#include <stdio.h>


void Tag()
{
__asm
ld a,#0xFF
call #0xBB63
ld hl,#100
ex de,hl
ld hl,#100
call #0xBBC0
ld a,#1
call #0xBBDE
ld a,#233
call #0xBB5A
__endasm;
}


void Mode(unsigned char nMode)
{
__asm
ld a, 4 (ix)
call #0xBC0E ;SCR_SET_MODE
__endasm;
}


void Move(unsigned int xadr,unsigned int yadr)
{
__asm
LD E, 4(IX)
LD D, 5(IX)
LD H, 6(IX)
LD L, 7(IX)
call #0xBBC0
__endasm;
}


void Printc(unsigned char nMode)
{
__asm
ld a, 4 (ix)
call #0xBB5A
__endasm;
}


void main()
{
Mode(1);
Tag();
 
Move(10,10);
Printc(65);
 
Move(14,10);
Printc(65);
 
Move(18,10);
Printc(65);
 
//KM_WAIT_CHAR   
__asm
call #0xBB06
__endasm;   
}

AMSDOS

Quote from: ervin on 04:46, 17 July 20
It has to be more like this:




void Tag()
{
__asm
ld a,#0xFF
call #0xBB63
ld hl,#100
ex de,hl
ld hl,#100
call #0xBBC0
ld a,#1
call #0xBBDE
ld a,#233
call #0xBB5A
__endasm;
}



Well if 'ld hl,#100' is meant to be like that, then shouldn't 'ld a,#0xff' read as 'ld a,#ff'?
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

ervin

Quote from: AMSDOS on 10:22, 17 July 20

Well if 'ld hl,#100' is meant to be like that, then shouldn't 'ld a,#0xff' read as 'ld a,#ff'?


No, because #ff is a hex value, so needs to be #0xff.

AMSDOS

Though I was thinking that 'ld hl,#100' were also hex values because of the '#', which would place the graphical cursor at 256x256. 
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

AMSDOS

Quote from: funkheld on 08:10, 17 July 20
Hi good afternoon.
I can not do it.
that's the program.

I got lost and can't get to my destination.

who knows about it in sdcc please.

thank you.
greeting



#include <stdio.h>


void Tag()
{
__asm
ld a,#0xFF
call #0xBB63
ld hl,#100
ex de,hl
ld hl,#100
call #0xBBC0
ld a,#1
call #0xBBDE
ld a,#233
call #0xBB5A
__endasm;
}


void Mode(unsigned char nMode)
{
__asm
ld a, 4 (ix)
call #0xBC0E ;SCR_SET_MODE
__endasm;
}


void Move(unsigned int xadr,unsigned int yadr)
{
__asm
LD E, 4(IX)
LD D, 5(IX)
LD H, 6(IX)
LD L, 7(IX)
call #0xBBC0
__endasm;
}


void Printc(unsigned char nMode)
{
__asm
ld a, 4 (ix)
call #0xBB5A
__endasm;
}


void main()
{
Mode(1);
Tag();
 
Move(10,10);
Printc(65);
 
Move(14,10);
Printc(65);
 
Move(18,10);
Printc(65);
 
//KM_WAIT_CHAR   
__asm
call #0xBB06
__endasm;   
}



I was suggesting to test it like this in SDCC:




#include <stdio.h>


void main()
{
__asm
ld a,#1
call #0xBC0E
ld a,#0xFF
call #0xBB63
ld hl,#100
ex de,hl
ld hl,#100
call #0xBBC0
ld a,#1
call #0xBBDE
ld a,#233
call #0xBB5A
call #0xBB06
__endasm;
}



If that doesn't work (not changing to MODE 1 for example), then perhaps SDCC has disabled the Firmware?


I'm only able to test in your SDCC example you posted with Phrozen C, which works, but the output for letter 'A' is along the Bottom Left corner with 2 'A' behind one another (see screenshot).
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod