Author Topic: TAG() not function in sdcc for cpc  (Read 1063 times)

0 Members and 1 Guest are viewing this topic.

Offline funkheld

  • CPC6128
  • ****
  • Posts: 244
  • Liked: 15
  • Likes Given: 0
TAG() not function in sdcc for cpc
« on: 00:27, 16 July 20 »

hello, good day.

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

can you help please.


tanks
greeting

Code: [Select]
#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;   
}
« Last Edit: 01:20, 16 July 20 by funkheld »

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.892
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1867
Re: TAG() not function in sdcc for cpc
« Reply #1 on: 02:10, 16 July 20 »
Seems to work fine for me from my Machine Code routine in BASIC.



Code: [Select]
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:


Code: [Select]
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

Offline funkheld

  • CPC6128
  • ****
  • Posts: 244
  • Liked: 15
  • Likes Given: 0
Re: TAG() not function in sdcc for cpc
« Reply #2 on: 10:58, 16 July 20 »
hello thanks.


this not funktion in the sdcc:
ex hl,de

greeting



Code: [Select]

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;
}

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.350
  • Country: au
    • index.php?action=treasury
  • Liked: 1003
  • Likes Given: 1195
Re: TAG() not function in sdcc for cpc
« Reply #3 on: 11:16, 16 July 20 »
I think it's meant to be
EX DE,HL
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.892
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1867
Re: TAG() not function in sdcc for cpc
« Reply #4 on: 12:22, 16 July 20 »
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

Offline funkheld

  • CPC6128
  • ****
  • Posts: 244
  • Liked: 15
  • Likes Given: 0
Re: TAG() not function in sdcc for cpc
« Reply #5 on: 17: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

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.892
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1867
Re: TAG() not function in sdcc for cpc
« Reply #6 on: 03:31, 17 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?



Code: [Select]
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;}
« Last Edit: 03:35, 17 July 20 by AMSDOS »
* 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

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.350
  • Country: au
    • index.php?action=treasury
  • Liked: 1003
  • Likes Given: 1195
Re: TAG() not function in sdcc for cpc
« Reply #7 on: 06: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;
}

EDIT: sorry, having issues with code tags in the forum editor!
« Last Edit: 06:49, 17 July 20 by ervin »
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline funkheld

  • CPC6128
  • ****
  • Posts: 244
  • Liked: 15
  • Likes Given: 0
Re: TAG() not function in sdcc for cpc
« Reply #8 on: 10: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

Code: [Select]

#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;   
}

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.892
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1867
Re: TAG() not function in sdcc for cpc
« Reply #9 on: 12:22, 17 July 20 »
It has to be more like this:


Code: [Select]

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

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.350
  • Country: au
    • index.php?action=treasury
  • Liked: 1003
  • Likes Given: 1195
Re: TAG() not function in sdcc for cpc
« Reply #10 on: 12:24, 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.
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.892
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1867
Re: TAG() not function in sdcc for cpc
« Reply #11 on: 12:29, 17 July 20 »
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

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.892
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1867
Re: TAG() not function in sdcc for cpc
« Reply #12 on: 01:38, 18 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

Code: [Select]

#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:


Code: [Select]

#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