RetroCoder Posted May 14, 2021 Share Posted May 14, 2021 I've been playing with some code and using atasm to assemble it. Loading the code and using the Altirra debugger is ready easy, especially with the -l options to dump the labels to a file. As long as the labels file has the same base filename as the executable all is ok. The only thing missing from the joy was source level debugging; Altirra's documentation mentioned you had to use mads or xasm. But atasm is my tool of choice, so I pulled the source code and made the changes. If you assemble a file with the -l and -g options you will now get a .lst file that allows source level debugging under Altirra. Also added support for the ;##TRACE and ;##ASSERT diagnostics. Quote ; Generate an altirra.lst and altirra.lab file with ; atasm -oaltirra.xex -laltirra.lab -galtirra.lst altirra.asm *=$2000 ; Start @ $2000 BOOT_THIS lda #0 sta storehere ;##TRACE "Display list address = $%04X" dw(vdslst) loop jmp loop storehere .byte 1 .bank * = $2e0 .word BOOT_THIS If you assemble the above file with atasm 1.11 (https://github.com/CycoPH/atasm) and launch Altirra like this: Altirra.exe altirra.xex /debugcmd:.loadsym /debug you will see Altirra break into the debugger and showing you where the display list is located. Clicking Debug and selecting "Source file list ..." will give you altirra.asm as an option. Load it and you will have full source level debugging 2 Quote Link to comment Share on other sites More sharing options...
Maury Markowitz Posted May 28, 2021 Share Posted May 28, 2021 Hey, nice addition! Have you considered sending this as a merge to the SF page for ATasm? Quote Link to comment Share on other sites More sharing options...
RetroCoder Posted May 28, 2021 Author Share Posted May 28, 2021 Some of my ATasm fixed have already been merged in. I want to fix a couple more of the reported problems and the make a merge request. For now the fixes are going into my GitHub repo. Quote Link to comment Share on other sites More sharing options...
Tyrop Posted November 27, 2021 Share Posted November 27, 2021 I am using ATasm 1.11 with WUDSN IDE and Altirra 3.90 to try to do source level debugging. I don't think the breakpoints inserted in the WUDSN IDE are working. ATasm makes the .lab and .lst files, but the .lst file is only one line long and says, "mads (generated by atasm)". My program is about 3000 lines of code with many labels and equates, so I'm thinking that the .lst file is not being created correctly. Altirra does not give me the source code window and instead says that my breakpoint is "deferred." Any help would be appreciated. Altirra never breaks into the debugger until I manually hit F8. This is what the Altirra console window says when I manually break: Altirra Debugger 3.90 Automatic symbol loading is enabled. Use .help for a list of commands and .help <cmdname> for help on a specific command. _______ Loaded symbols F:\Atari\ATasm\CENT36.lst Loaded symbols F:\Atari\ATasm\CENT36.lab Loaded debugger script F:\Atari\ATasm\CENT36.atdbg Source debugging mode is now on. Loading executable... 0 breakpoint(s) cleared. Deferred breakpoint 0 set at F:\Atari\ATasm\CENT36.ASC:221. EXE: Loading program 0006-0007 to 02E0-02E1 EXE: Loading program 000C-0026 to 1F03-1F1D EXE: Loading program 002B-0037 to 1F36-1F42 EXE: Loading program 003C-003E to 1F5D-1F5F EXE: Loading program 0043-0045 to 2000-2002 EXE: Loading program 004A-052B to 2051-2532 EXE: Loading program 0530-0541 to 2534-2545 EXE: Loading program 0546-0557 to 2547-2558 EXE: Loading program 055C-056D to 255A-256B EXE: Loading program 0572-07C3 to 256D-27BE EXE: Loading program 07C8-07D9 to 27C0-27D1 EXE: Loading program 07DE-07EF to 27D3-27E4 EXE: Loading program 07F4-0805 to 27E6-27F7 EXE: Loading program 080A-0A03 to 27F9-29F2 EXE: Loading program 0A08-0A19 to 29F4-2A05 EXE: Loading program 0A1E-0A2F to 2A07-2A18 EXE: Loading program 0A34-0A45 to 2A1A-2A2B EXE: Loading program 0A4A-0D4E to 2A2D-2D31 EXE: Loading program 0D53-1C67 to 3000-3F14 EXE: Launching at 2000 (145:248, 0) A=AE X=0A Y=03 S=F4 P=30 ( ) 2243: B1 C1 LDA (MISCL),Y [$37AB] = $37 Quote Link to comment Share on other sites More sharing options...
RetroCoder Posted November 27, 2021 Author Share Posted November 27, 2021 Here is how I get it done. Some asm, save it as test.asm ----- ; A simple test app to put some color on the screen COLPF2 = $d018 COLBK = $D01A WSYNC = $d40a VCOUNT = $d40b RTCLOK = $14 * = $2000 BOOT_THIS lda #0 sta test loop lda RTCLOK tay clc adc VCOUNT tax tya asl sec sbc VCOUNT sta WSYNC sta COLBK stx COLPF2 jmp loop test: .byte 0 *=$2e0 .word BOOT_THIS ----- Assemble with: atasm.exe -otest.xex -ltest.lab -gtest.lst "test.asm" This will produce the test.lst file ---- mads (generated by atasm) Source: test.asm 10 2000 A9 00 lda #0 11 2002 8D 1F 20 sta test 13 2005 A5 14 lda RTCLOK 14 2007 A8 tay 15 2008 18 clc 16 2009 6D 0B D4 adc VCOUNT .... ----- and the .lab file with the three defined symbols 2000 BOOT_THIS 2005 LOOP 201f TEST Note the "mads (generated by atasm)" line in the .lst file, that is required by altirra (at least the "|mads (" part) to enable source level debugging. Just those two files should give you source level debugging. Press F8 to break into the Altirra debugger and it will have loaded the symbols and source code or might ask you for the folder where the source code is, but it works. To get source level debugging with break-points to work you need an atdbg file. It should be created by your IDE. In the Atasm-Altirra-Bridge VScode plugin it looks at your breakpoints and generates the file. I've not used WUDSON but I'm sure there is a way to get it done. I put a breakpoint on line 10 & 11 (lda #0 sta test) and this is was the VSCode plugin generated ------ bc * bp -k -q `test.asm:10` bp -k -q `test.asm:11` .echo 2 breakpoints from 1 files have been set} .sourcemode on ------ bc clears all the break points bp sets a break-point at line 10 and 11 .sourcemode on - turns on source level debugging Note that I've never gotten the first break-point to hit, the second always hits. Atasm also sends out the ##TRACE commands correctly, so you can embed something like this ;##TRACE "Your acc = $d" @a into your code and the altirra debugger will dump a line "your acc = 123" or whatever your A register was every time it sees that code in the program execution test.atdbg test.brk test.lab test.lst test.asm Quote Link to comment Share on other sites More sharing options...
Tyrop Posted November 27, 2021 Share Posted November 27, 2021 Thank you for the detailed response. Do I need to have a ##TRACE statement somewhere? I am not using ##TRACE. I think what is happening is that the .lst file is not being created correctly for this program. I tested with a small program, and it worked perfectly (with the .lst file being populated by the listing and with Altirra showing me the source window). But with my longer program, the .lst file is only one line long, and just has "mads (generated by atasm)" on the first line, but no other lines. This is my command line: atasm.exe -ocent36.xex -lcent36.lab -gcent36.lst "cent36.asc" I am executing the command line in the correct folder, which is: F:\Atari\ATasm, and all the source files are in that folder, and all the created files are also in that folder. I put the breakpoint at line 221 in the WUDSN IDE editor. And this is the .atdbg file: .sourcemode on .echo .echo "Loading executable..." .echo bc * .onexerun .echo "Launching executable..." bp "`F:\Atari\ATasm\CENT36.ASC:221`" Altirra ignores the breakpoint. I have to press F8 in Altirra. I see the disassembly window with the correct labels, but no source listing window. The Altirra console says that it loaded the .lab file, the .lst file and the .atdbg file. It then says (among other things), Deferred breakpoint 0 set at F:\Atari\ATasm\CENT36.ASC:221. My program has .INCLUDE's in it. Could that be a problem? Quote Link to comment Share on other sites More sharing options...
RetroCoder Posted November 27, 2021 Author Share Posted November 27, 2021 Includes should not be a problem. I'll install wudsn and see what I can figure out, and report back here Quote Link to comment Share on other sites More sharing options...
RetroCoder Posted November 27, 2021 Author Share Posted November 27, 2021 Ok I figured it out for you. I modified the parameters for atasm like this: -s -o${outputFilePath} -l${outputFilePathWithoutExtension}.lab -g${outputFilePathWithoutExtension}.lst ${sourceFilePath} And setup Altirra to launch with the following parameters: ${runnerExecutablePath} /singleinstance /run ${outputFilePath} /debug /debugcmd:.loadsym The /debug and /debugcmd:.loadsym parameters get Altirra into debug mode. I'm still only hitting the second break point. I also changed the source to move some code into a second file that is included and it works fine. Below is a picture of the settings. If you can't come right PM me and I'm more than happy to help you fix this 1 Quote Link to comment Share on other sites More sharing options...
kenames99 Posted November 28, 2021 Share Posted November 28, 2021 hi RetroCoder, nice work. but I have a request for atasm, could you fix it/feature update it to print assemble labels, like "BOOT_THIS" or "loop" from your first post in this topic. it currently only outputs labels if an opcode is present on the same line. thanks. Ken Quote Link to comment Share on other sites More sharing options...
RetroCoder Posted November 28, 2021 Author Share Posted November 28, 2021 7 hours ago, kenames99 said: hi RetroCoder, nice work. but I have a request for atasm, could you fix it/feature update it to print assemble labels, like "BOOT_THIS" or "loop" from your first post in this topic. it currently only outputs labels if an opcode is present on the same line. thanks. Ken I've published version 1.12 of atasm at https://github.com/CycoPH/atasm When specifying the -g option it will now output the last label defined for a memory location on the line of the operand. Quote Link to comment Share on other sites More sharing options...
RetroCoder Posted November 30, 2021 Author Share Posted November 30, 2021 I've added another requested feature to Atasm V1.13 (and to the atasm-altirra-bridge vscode plugin) You can now use the -hc and -ha switches to generate CC65 header and atasm include files for your project. This should make it easy to write some asm code and integrate it with CC65 or link it as an object in other assembler projects. https://github.com/CycoPH/atasm https://marketplace.visualstudio.com/items?itemName=cerebus.atasm-altirra-bridge 1 Quote Link to comment Share on other sites More sharing options...
kenames99 Posted November 30, 2021 Share Posted November 30, 2021 hi, again I say - Great Work! thank you for all this. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.