CBM prg Studio

You need an actual VIC.

Moderator: Moderators

ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

Sorry for the late reply!

First off, 'ror acc+1' isn't being assembled properly. It's being assembled to $66, which is the zero page ror. If you give the label 'acc' a value it works as expected. This is definitely a bug though as the assembler should say that 'acc' hasn't been defined.

@Kweepa, what are anonymous labels? I've never heard of them! No there aren't any macros, I might add them but I didn't think anyone used them, to be honest.

As for the binary import, the best way is to load it into the memory viewer and disassemble it from there.
rhurst
Omega Star Commander
Posts: 1369
Joined: Thu Jan 31, 2008 2:12 pm
Website: https://robert.hurst-ri.us
Location: Providence, RI
Occupation: Tech & Innovation

Post by rhurst »

Anonymous labels and macros are 'advanced' features of a, well, macro assembler... adding macros to any degree that other assemblers have already will take quite a bit of time and add a lot of complexity for the compiler, editor, documentation, end user, . . .

I'd like to suggest you continue to focus on your project's objective of being a friendly IDE for Commodore computers: so far it achieves this for BASIC, assembler, charset/sprite graphics, and even debugging has been introduced. Adding tools to integrate SID music as part of the project, or a wizard to convert WAV files into usable 4- or 8-bit playback data, or support for BASIC Super Expander, 3.5 (TED) and 7.0 (128) would be very cool next steps.

IMO, the (integrated) debugger should mature in a way that allows it to be useful for the beginner/enthusiast as a learning aide. For debugging that is better achieved within the target Commodore host, launching the project with a DEBUG boolean checkbox would be 'friendly'... if enabled, it could add some sort of Programmer's Aide function to the emulator's cartridge slot, like TRACE ON / TRACE OFF if my memory serves. For assembler projects, leverage the debugger already present in the emulator (VICE and MESS both have very mature debuggers) -- make for easier integration of that process by launching them with their appropriate command-line switches to have their debugger's enabled at startup; and you can advance that process more if the project can export assembler symbols and have them load into the emulator's debugger -- VICE does that extremely well and makes for a much friendlier debugging session for the programmer to simply 'watch SYMBOL' rather than doing a manual lookup of what SYMBOL resolves as some hex address to enter for each session.
Any technology distinguishable from magic is insufficiently advanced.
https://robert.hurst-ri.us/rob/retrocomputing
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

Thanks for that. Based on your comments I think I'll concentrate on two areas for the moment:

* Integrate and add support for symbols in my debugger,
* Add support for using third party debuggers. I didn't know VICE even had a debugger until recently! I might need some help with this.

My debugger was never meant to compete with the 'big boys', but you're right, it is useful as a learning tool and for testing small programs, as is CBM prg Studio in general.

I'm not quite sure what you mean about adding Programmer's Aid functions to the cartridge slot, but that can wait until a later date.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Another bug:

Loads and stores to the zero page are assembled correctly, but if the zero page address is odd (I think this is the condition), the assembler adds BRK ($00) after the instruction.

I wouldn't lump anonymous labels and macros together. Anonymous labels are great for my coding speed as I don't have to get all caught up coming up with a decent name for a jump destination. Here's an example using ACME syntax.

-
lda xstep
beq +
dec
cmp #12
beq ++
+
dey
bne -
++
rts

I hope that's self explanatory :)

On the learning tool front, I would love a feature that adds column (like the line numbers) showing the number of bytes and the timings for each instruction. Perhaps highlighting a block of code could sum those up and put it in a tooltip.

Awesome job so far! Hopefully I'll have a CBM Prg Studio produced game soon.
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

Kweepa wrote:Another bug:

Loads and stores to the zero page are assembled correctly, but if the zero page address is odd (I think this is the condition), the assembler adds BRK ($00) after the instruction.
Can you post some sample code (it doesn't have to be all of it) which does this? I can't reproduce it here.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Code: Select all

*=$A0
mac     word    0
ext     word    0
aux     word    0
*=$1400
mult
        sta     mac
        stx     mac+1
mult_
        lda #0
        sta ext+1
        ldy #$11
        clc
mulloop
        ror ext+1
        ror
        ror mac+1
        ror mac
        bcc mul2
        clc
        adc aux
        tax
        lda aux+1
        adc ext+1
        sta ext+1
        txa
mul2    
        dey
        bne mulloop
        lda mac+1
        rts
Produces (Program/Generate Code -> To Memory)

Code: Select all



                  *=$A0

00A0   00         BRK
00A1   00         BRK
00A2   00         BRK
00A3   00         BRK
00A4   00         BRK
00A5   00         BRK

                  *=$1400

1400   85 A0      STA $A0
1402   86 A1      STX $A1
1404   00         BRK
1405   A9 00      LDA #$00
1407   85 A3      STA $A3
1409   00         BRK
140A   A0 11      LDY #$11
140C   18         CLC
140D   66 A3      ROR $A3
140F   00         BRK
1410   6A         ROR
1411   66 A1      ROR $A1
1413   00         BRK
1414   66 A0      ROR $A0
1416   90 0E      BCC $1426
1418   18         CLC
1419   65 A4      ADC $A4
141B   AA         TAX
141C   A5 A5      LDA $A5
141E   00         BRK
141F   65 A3      ADC $A3
1421   00         BRK
1422   85 A3      STA $A3
1424   00         BRK
1425   8A         TXA
1426   88         DEY
1427   D0 E4      BNE $140D
1429   A5 A1      LDA $A1
142B   00         BRK
142C   60         RTS
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

@Kweepa,
Thanks for that, I think I've fixed it but I'll do some more testing and get a new version to you soon. If you like could you PM me with an address I can sent it to, or if not I'll put it on my fileshare.

Cheers
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Another small bug:

Code: Select all

byte $9e
Results in 9, not 9E, being added to the machine code.
I worked around it by using

Code: Select all

byte 158
2011SYS4109 added :)
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

Heh, I broke this in the newer version I sent you, it works in the 'proper' release.

I'm planning on releasing a new version on Friday evening (UK time) which fixes this and some other bugs. It also has the debugger integrated properly.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Another little bug:

Code: Select all

ora #>textures
didn't produce any output. It just skipped to the next instruction. I hardcoded

Code: Select all

ora #$16
and it worked fine.

Any sign of the new version? I can't wait to try out the integrated debugging!
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

Thanks for that.

The new version was supposed to be out last Friday but I had a few last minute bug reports (like this one!) to fix. Hopefully it'll be ready by Wednesday.
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

And here it is! Version 1.3.0 has been released and can be downloaded from www.ajordison.co.uk . Once again, thanks for all the help and support.

Enjoy :wink:
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Hi AJ,

Another bug report. The first part is perhaps a feature?

Code: Select all

callback_fn = $20 ; ZP or not, no difference
...
    ; push return address onto stack, msb then lsb
    lda #>(callback_rts-1)
    pha
    lda #<(callback_rts-1)
    pha
    jmp (callback_fn)
callback_rts
If I try to compile this code, the LDAs just have 0 as their operand, and the JMP indirect doesn't compile: Invalid operand, label, or variable.

I can work around it for now with

Code: Select all

   lda #>callback_rts
   pha
   lda #<callback_rts
   clc
   sbc #1
   pha
   jmp ($20)
callback_rts
or

Code: Select all

   lda #>callback_rts
   pha
   lda #<callback_rts
   pha
   byte $6c, $20 ; jmp ($20)
callback_rts
   byte 0
But it wastes a few bytes / isn't as legible...

Thanks,
Steve
ajordison
Vic 20 Enthusiast
Posts: 179
Joined: Fri Mar 19, 2010 4:31 pm
Website: http://www.ajordison.co.uk/
Location: Hartlepool, UK
Occupation: Software Engineer

Post by ajordison »

Hi Steve,

I might have fixed this. Assembling this program:

Code: Select all

*=$c000

callback_fn = $20 ; ZP or not, no difference ... 
    ; push return address onto stack, msb then lsb 
    lda #>callback_rts-1
    pha 
    lda #<callback_rts-1 
    pha 
   jmp (callback_fn) 
callback_rts rts
(I had to remove the braces after the LDAs)

Gives this output:

Code: Select all

                  *=$C000

C000   A9 C0      LDA #$C0
C002   48         PHA
C003   A9 08      LDA #$08
C005   48         PHA
C006   6C 20 00   JMP ($0020)
C009   60         RTS
Is this what you would expect?

Cheers.
User avatar
Kweepa
Vic 20 Scientist
Posts: 1314
Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker

Post by Kweepa »

Looks good!
Post Reply