Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kick Assembler support #70

Open
chrisgleissner opened this issue Aug 28, 2022 · 7 comments
Open

Kick Assembler support #70

chrisgleissner opened this issue Aug 28, 2022 · 7 comments

Comments

@chrisgleissner
Copy link

chrisgleissner commented Aug 28, 2022

Hi,

the combination of using MS Visual Code and a Kick Assembler plugin is becoming increasingly popular, see for example https://marketplace.visualstudio.com/items?itemName=sanmont.kickass-studio. Kick Assembler has a lot of feature which the assemblers currently supported by C64Studio lack.

Would it be possible to add Kick Assembler (http://theweb.dk/KickAssembler/Main.html#frontpage) support?

Thanks
Christian

@chrisgleissner chrisgleissner changed the title KickAssembler support Kick Assembler support Aug 28, 2022
@GeorgRottensteiner
Copy link
Owner

It kinda depends how far the support should reach. The basic syntax is easily doable.
Basically all the extended scripty stuff is nigh on impossible, it would require to re-implement all that; and that usually goes with lots of subtle differences.

@chrisgleissner
Copy link
Author

Would it be possible to perform syntax highlighting for Kick Assembler preprocessor directives (they all start with "#", see http://theweb.dk/KickAssembler/webhelp/content/apas02.html) and assembler directives (they all start with ".", see http://theweb.dk/KickAssembler/webhelp/content/apas04.html) and then add an option in C64 Studio to configure the location of the Kick Assembler executable? This executable would then need to be called when building the assembly via any of the build options in the Build menu.

This will probably leave KickAssembler not as tightly integrated as the other assembly dialects you already support, but it would already be usable and a good alternative to Visual Studio Code and its Kick Assembler extensions.

@GeorgRottensteiner
Copy link
Owner

GeorgRottensteiner commented Aug 28, 2022

Syntax highlighting and directives would be easy.
You can already configure a "custom" build step, which would call Kick Assembler.

Note that debugging is probably pretty off then, as soon as scripting is added, as that requires C64Studio to know exactly which address maps to which part of the code. Unless KickAss could emit a code mapping file, similar to what Emscripten does.

@chrisgleissner
Copy link
Author

I'll have a look at the "custom" build step that you mentioned to get a feel for the current integration. Debug support is of course quite important, i.e. being able to step through the code line by line and watch the registers and how it affects a simultaneously running Vice.

There is a Visual Studio Code extension which supports a debugger. I am not sure how it's done on a low level, but maybe this very same approach is something that C64 Studio could support as well in order to work around the debug problem that you pointed out, see https://marketplace.visualstudio.com/items?itemName=paulhocker.kick-assembler-vscode-ext#:~:text=Kick%20Assembler%208%2DBit%20Retro%20Studio%20is%20an%20open%2Dsource,using%20the%20awesome%20Kick%20Assembler%20.

I used to do a lot of assembly coding in the early 90s - just getting back into it and comparing IDEs. Ideally I'd want to use a single IDE. Thanks for explaining what's possible and what would be problematic.

@chrisgleissner
Copy link
Author

chrisgleissner commented Aug 28, 2022

Hi,

I had another look at how the aforementioned Visual Studio handles Kick Assembler, Vice and C64 Debugger integration.

When you start the compilation run in Visual Studio, it launches Kick Assembler. This generates both the .prg file as well as a debug dump file. The latter corelates the generated bytes and assembly source, see http://theweb.dk/KickAssembler/webhelp/content/cpt_QuickReference.html. This debug dump is then read by the C64Debugger.

Here's an example.

test.asm:

*= $0801
BasicUpstart(main)

*= $0810
main:
.break
		inc $d021
l1:	
		inc cntlo
		bne l1
		inc cnthi
		bne l1
		jmp main
cntlo:	.by 0
cnthi:  .by 0

Assembly run:
java -jar KickAss.jar test.asm -debugdump

Resulting test.dbg file for the C64 Debugger:

Relevant is the Segment section. Start and end (inclusive) byte ranges are in cols 1 and 2, whereas the corresponding source line section is found in cols 4 and 6, respectively.

<C64debugger version="1.0">
   <Sources values="INDEX,FILE">
      0,KickAss.jar:/include/autoinclude.asm
      1,C:\Dev\C64\Tmp\test.asm
   </Sources>

   <Segment name="Default" dest="" values="START,END,FILE_IDX,LINE1,COL1,LINE2,COL2">
      <Block name="Unnamed">
         $0801,$0802,0,38,2,38,6
         $0803,$0804,0,39,5,39,9
         $0805,$0805,0,40,5,40,9
         $0806,$0809,0,41,2,41,6
         $080a,$080a,0,42,2,42,6
         $080b,$080c,0,44,5,44,9
      </Block>
      <Block name="Unnamed">
         $0810,$0812,1,7,3,7,5
         $0813,$0815,1,9,3,9,5
         $0816,$0817,1,10,3,10,5
         $0818,$081a,1,11,3,11,5
         $081b,$081c,1,12,3,12,5
         $081d,$081f,1,13,3,13,5
         $0820,$0820,1,14,8,14,10
         $0821,$0821,1,15,9,15,11
      </Block>
   </Segment>

   <Labels values="SEGMENT,ADDRESS,NAME,START,END,FILE_IDX,LINE1,COL1,LINE2,COL2">
      Default,$0810,main,1,5,1,5,5
      Default,$0813,l1,1,8,1,8,3
      Default,$0820,cntlo,1,14,1,14,6
      Default,$0821,cnthi,1,15,1,15,6
      Default,$080b,upstartEnd,0,43,1,43,11
   </Labels>

   <Breakpoints values="SEGMENT,ADDRESS,ARGUMENT">
      Default,$0810,
   </Breakpoints>

   <Watchpoints values="SEGMENT,ADDRESS1,ADDRESS2,ARGUMENT">
   </Watchpoints>

</C64debugger>

@GeorgRottensteiner
Copy link
Owner

Nice! That looks easy enough to read, and also something C64Studio could provide for C64Debugger itself. Thanks!

@chrisgleissner
Copy link
Author

Glad it helped. If I can be of any further help with this, please let me know. I am keen to use Kick Assembler both as the Microsoft Visual Studio extension and as part of your excellent C64 Studio since you offer much more tooling around sound and image generation that the Visual Studio approach lacks. So would be really nice being able to open the same .asm files from both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants