English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 19 June 2020, 08:48   #81
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
Perfect. Thanks Deimos! I can rip out my jump table.
Antiriad_UK is offline  
Old 19 June 2020, 11:06   #82
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
Quote:
Originally Posted by deimos View Post
This is how I do it:

The
"cc", "memory"
bit says that the assembly code will clobber the condition code register and memory, so disable any optimisations that depend on them. You can specify individual registers that get clobbered as well, which may allow for smarter optimisations.
If the function call trashes say d0-d7 does the compiler save/restore all the regsiters by default or do you have to specify that here to stay safe?
Antiriad_UK is offline  
Old 19 June 2020, 11:33   #83
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by Antiriad_UK View Post
If the function call trashes say d0-d7 does the compiler save/restore all the regsiters by default or do you have to specify that here to stay safe?
You need to specify them, so probably
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "cc", "memory"
.

You can still do the normal movem thing to save them yourself, if you prefer, but the compiler may be able to be more selective about what it saves.

EDIT: There are some caveats, such as not being allowed to modify inputs unless they're also specified as outputs, so, assuming you are passing inputs, they may have to be listed as outputs rather than as clobbers. https://gcc.gnu.org/onlinedocs/gcc/E...atch-Registers

Last edited by deimos; 19 June 2020 at 11:58.
deimos is offline  
Old 19 June 2020, 11:56   #84
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
Ok with your examples and that web page it's getting clear now. Much appreciated
Antiriad_UK is offline  
Old 08 July 2020, 12:16   #85
Gazzer
Registered User
 
Join Date: Apr 2011
Location: Fareham/UK
Posts: 17
Error trying to follow instructions to start a project

Hi, as above. I've downloaded and installed the VScode and then installed the extension (in fact, I tried twice, uninstalling and re-installing vscode) and then, following the instructions I tried to create an empty folder, at which point I get this message:


One or more dirty editors could not be saved or reverted - try saving or reverting the dirty editors first and then try again."


I can't even guess what that means!


However pushing on, I then try to Ctrl-Shift-P and select Amiga: Init project, but get a further error "Failed to Init Project", which is probably related to the initial message , but I don't know.


And one last question (for now!) How do I do this: Open .vscode/launch.json - I don't know where to find this.


Thanks for your help.
Gazzer is offline  
Old 08 July 2020, 12:39   #86
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by Gazzer View Post
Hi, as above. I've downloaded and installed the VScode and then installed the extension (in fact, I tried twice, uninstalling and re-installing vscode) and then, following the instructions I tried to create an empty folder, at which point I get this message:


One or more dirty editors could not be saved or reverted - try saving or reverting the dirty editors first and then try again."


I can't even guess what that means!


However pushing on, I then try to Ctrl-Shift-P and select Amiga: Init project, but get a further error "Failed to Init Project", which is probably related to the initial message , but I don't know.


And one last question (for now!) How do I do this: Open .vscode/launch.json - I don't know where to find this.


Thanks for your help.
I would guess that it's a file ownership / permission problem. Maybe there are files left over from your first attempt at installing, and maybe they're owned by the administrator account?

Where are you trying to create your empty folder?

The vscode/launch.json file will be there once you've successfully created a project.
deimos is offline  
Old 09 July 2020, 08:22   #87
Gazzer
Registered User
 
Join Date: Apr 2011
Location: Fareham/UK
Posts: 17
Yes, that worked, thank you. Still got problems - nothing ever seems to work out of the box as it were - but I'll try to solve them before I come running here!
Gazzer is offline  
Old 02 August 2020, 14:04   #88
Nightfox
Registered User
 
Nightfox's Avatar
 
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
I'm using this extension to code an Amiga app and I'm following the Amiga ROM Kernel Reference Manual to try to open a port so that I can use console.device. CreatePort() is what I need to use but apparently that is only available in a library called amiga.lib? Is there anyway of doing this via this vscode extension?
Nightfox is offline  
Old 03 August 2020, 09:00   #89
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by Nightfox View Post
I'm using this extension to code an Amiga app and I'm following the Amiga ROM Kernel Reference Manual to try to open a port so that I can use console.device. CreatePort() is what I need to use but apparently that is only available in a library called amiga.lib? Is there anyway of doing this via this vscode extension?
There are several amiga.libs that you might be able to build yourself, or just take the handful of functions you need from:

https://github.com/adtools/libnix/bl...c/CreatePort.c

Code:
struct MsgPort *CreatePort(CONST_STRPTR name,LONG pri)
{ APTR SysBase = *(APTR *)4L;
  struct MsgPort *port = NULL;
  UBYTE portsig;

  if ((BYTE)(portsig=AllocSignal(-1)) >= 0) {
    if (!(port=AllocMem(sizeof(*port),MEMF_CLEAR|MEMF_PUBLIC)))
      FreeSignal(portsig);
    else {
      port->mp_Node.ln_Type = NT_MSGPORT;
      port->mp_Node.ln_Pri  = pri;
      port->mp_Node.ln_Name = name;
      /* done via AllocMem
      port->mp_Flags        = PA_SIGNAL;
      */
      port->mp_SigBit       = portsig;
      port->mp_SigTask      = FindTask(NULL);
      NEWLIST(&port->mp_MsgList);
      if (port->mp_Node.ln_Name)
        AddPort(port);
    }
  }
  return port;
}
The bottom of this page https://github.com/adtools/libnix/tr...bdf3fab99cab61 has a list that might be worth looking at.
deimos is offline  
Old 03 August 2020, 13:14   #90
Nightfox
Registered User
 
Nightfox's Avatar
 
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
Thank you so much Deimos! Now I can maintain Kickstart 1.3 backwards compatibility for the DF0 Diskmag project I am working on! <3
Nightfox is offline  
Old 23 August 2020, 17:46   #91
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
What a great stuff! I have tried latest release 1.1.0-preview31 and works like a charm!

Only two things. Vscode shown that 'a0, 'd0' etc etc are unknown registers. It compiles right but it is strange.

And in the profiler screen I can´t see any red bar color like that in the screen showed here.

Lets play a bit more. It rocks!!
tolkien is offline  
Old 24 August 2020, 11:48   #92
Spec-Chum
Registered User
 
Join Date: Dec 2016
Location: England
Posts: 87
Quote:
Originally Posted by tolkien View Post
Vscode shown that 'a0, 'd0' etc etc are unknown registers. It compiles right but it is strange.
It's an Intellisense issue, it only knows x86 and arm, so 'a0' and 'd0' etc are alien to it, only 'eax', 'esi' etc

I'm not even sure there's a way to fix it directly, but you should be able to wrap the offending code in an
Code:
#ifndef __INTELLISENSE__
Spec-Chum is offline  
Old 25 August 2020, 11:48   #93
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,406
I've been a bit confused about this. Suppose I want to create a program that loads in data from disk. How do I get the debugger to also have this data available in the debug environment?

I'm sure I'm missing something really obvious here, but I've not found the correct way to do this.
roondar is offline  
Old 03 October 2020, 13:56   #94
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,801
@Bartman,

Is it possible to use your setup for AmigaOS system programming targeting 3.x too?
kamelito is offline  
Old 03 October 2020, 14:48   #95
Bastich
Registered User
 
Bastich's Avatar
 
Join Date: Jul 2011
Location: UK
Posts: 341
This is really cool. Is there a way of using Visual Studio Community 2019?
Bastich is offline  
Old 09 October 2020, 22:24   #96
Bartman
Registered User
 
Join Date: Feb 2019
Location: Munich, Germany
Posts: 63
Quote:
Originally Posted by Bastich View Post
This is really cool. Is there a way of using Visual Studio Community 2019?
unfortunately not. This extension started out on regular Visual Studio, but it was just too buggy.
Bartman is offline  
Old 09 October 2020, 22:26   #97
Bartman
Registered User
 
Join Date: Feb 2019
Location: Munich, Germany
Posts: 63
Quote:
Originally Posted by kamelito View Post
@Bartman,

Is it possible to use your setup for AmigaOS system programming targeting 3.x too?
It's not intended for that purpose, but should work alright. But please first update to at least 1.1-preview33 at https://github.com/BartmanAbyss/vsco...debug/releases (will be available in the next days), because the older versions didn't have all system includes. And then use a config like 'A1200' to get KS 3.1
Bartman is offline  
Old 09 October 2020, 22:28   #98
Bartman
Registered User
 
Join Date: Feb 2019
Location: Munich, Germany
Posts: 63
Quote:
Originally Posted by roondar View Post
I've been a bit confused about this. Suppose I want to create a program that loads in data from disk. How do I get the debugger to also have this data available in the debug environment?

I'm sure I'm missing something really obvious here, but I've not found the correct way to do this.
You mean data as in non-code data? Just put it in the same directory as the output exe and load it from your program with standard dos.library. The extension maps the directory that your exe is in as 'dh1:' and it's available as the current directory.
Bartman is offline  
Old 09 October 2020, 22:30   #99
Bartman
Registered User
 
Join Date: Feb 2019
Location: Munich, Germany
Posts: 63
I'm not monitoring this thread as often as I probably should, so if you don't get a reply from me, try on github instead.
Bartman is offline  
Old 20 August 2021, 15:54   #100
BomberMillz
Registered User
 
Join Date: Mar 2019
Location: Nu Forest UK
Posts: 31
This looks very good. Thanks to Bartman for the hard work.

However, is there a way of using this with VSCodium, rather than having to go on the MS marketplace?

(Thats the open-source trackerless version, which should work exactly the same internally.)
BomberMillz is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Amiga Assembly extension for Visual Studio Code prb28 Coders. Asm / Hardware 342 15 December 2023 21:22
Visual Studio Code Blitz Basic extension earok Coders. Blitz Basic 29 16 July 2019 17:59
very basic C/ASM/Visual Studio hand holding Sephnroth Coders. C/C++ 2 08 March 2016 20:15
Profiling WinUAE with Visual Studio 2013 mark_k support.WinUAE 3 14 January 2014 20:26

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:25.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.19344 seconds with 14 queries