Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Coding on a PC for the 64?
2016-01-11 05:53
Stablizer

Registered: Jan 2016
Posts: 19
Coding on a PC for the 64?

I've seen various editors out there, currently starting to use the C64Studio for this, but it seems like getting charsets, graphics, music, etc, is a bit problematic when going at it this way, isn't it?

Would love to get some pointers to reading material on the subject (have done some searches already, but haven't come up with anything notable really).

Thanks!
-Stab
 
... 179 posts hidden. Click here to view all posts....
 
2016-01-26 19:20
Oswald

Registered: Apr 2002
Posts: 5094
well, I actually drew sprites and even charset on paper, but that was when I didnt know yet asm, neither had idea the existence of editors, nor it occured to me there could be one. well I was a kid who didnt see anything yet. :)
2016-01-26 19:42
ChristopherJam

Registered: Aug 2004
Posts: 1409
An extract from Reutastic's source:
def exrv(x):
    if x==12*8:
        return [0xdd02,0x3c+1]
    if x<12*8:
        return[0xd018,0x80+16*(x%8)]
    else:
        return[0xd018,0xf0-16*(x%8)]
def exr(x):
    return exrv(x)[0]
def exv(x):
    return exrv(x)[1]


with open('data.inc','a') as defs:
    defs.write('exr__1=$%02x\n'%exr(-1))
    defs.write('exr000=$%02x\n'%exr(0))
    defs.write('exr001=$%02x\n'%exr(1))
    defs.write('exr200=$%02x\n'%exr(200))

    defs.write('exv__1=$%02x\n'%exv(-1))
    defs.write('exv000=$%02x\n'%exv(0))
    defs.write('exv001=$%02x\n'%exv(1))
    defs.write('exv200=$%02x\n'%exv(200))

    defs.write('d00d2=$%02x\n'%(vic[0x0d]+21))
    defs.write('paletteEntriesPerRow=$%02x\n'%(paletteEntriesPerRow,))


with open('copper.inc','w') as copper:
    for line in range(1,201):  # first d011 write fetches second raster
        i=line-1
        ph=(line-1-1)%21
        y=(0x39+line-1)&0xff

        if line==200:
            copper.write("\tlda#$7f:sta $d011\n")
            copper.write("\tldy#$%02x:sty REU_ADDRE+1 ; FINAL\n" %y          )
            copper.write("\tstx REU_CMD\n")
        elif ph>13 or line>190:

            if line>1:
                copper.write("\t%s:lda#$%02x:sta $%04x        ;  line %3d\n"% ( ["nop","clc"][line%2],exv(line),exr(line),line))
            copper.write("\tldy#$%02x:sty REU_ADDRE+1\n" %y          )
            copper.write("\tstx REU_CMD:lda#$%02x:sta $d011\n\n\n"%( 32+(line+0)%8+[16,24][line>190]))
        elif ph%2==0:
            copper.write("\tlda#$%02x:sta $%04x:lda#$%02x    ;  line %3d\n" %(exv(line),exr(line),exv(line+1),line))
            copper.write("\tldy#$%02x:sty REU_ADDRE+1\n" %y          )
            copper.write("\tstx REU_CMD:inc $d011\n\n"        )
        else:
            copper.write("\tsty$d00%x:sta $%04x           ;  line %3d\n" %(ph,exr(line),line)   )
            copper.write("\tldy#$%02x:sty REU_ADDRE+1\n" %y          )
            copper.write("\tstx REU_CMD:lda#$%02x:sta $d011\n\n\n"%( 32+(line+0)%8+0x10))

14 lines out of every 21 bar the last ten, I'm splitting sprite y updates across pairs of lines, and there are different rule for d018 updates for the two banks.
Probably could have written a generator in 6502, but Python was just easier, and besides it's only 15 blocks so ¯\_(ツ)_/¯
2016-01-26 21:23
JackAsser

Registered: Jun 2002
Posts: 2014
Lame! Code generator used in the hidden lines vector of the 1991-demo by Booze. Each object has custom code to calculate the rotation of every vertex and normals, not data driven. So, to pack that code I created a byte code that is execute to control the flow of the code generator:

Byte code parser:
.include "zp.inc"

.export generateCodeFromByteCode
.proc generateCodeFromByteCode
                                stx z2+0
                                sta z2+1
                                lda #<RotateCode
                                sta z1+0
                                lda #>RotateCode
                                sta z1+1

                                nextCode:
                                        ldy #0
                                        lax (z2),y
                                        bmi done
                                        iny
                                        stx tmp
                                        lda template_handler_lo,x
                                        sta sm1+1
                                        lda template_handler_hi,x
                                        sta sm1+2
                                        clc
                                        lda (z2),y
                                        iny
                                        sm1: jsr $1234
                                        tya
                                        clc
                                        adc z2+0
                                        sta z2+0
                                        bcc :+
                                                inc z2+1
                                        :
                                        ldy tmp
                                        jsr emitTemplate
                                jmp nextCode


Template instancer:
.proc emitTemplate
                                lda templates_size,y
                                tax
                                dex
                                lda templates_lo,y
                                sta z3+0
                                lda templates_hi,y
                                sta z3+1
                                ldy #0
                                :
                                        lda (z3),y
                                        sta (z1),y
                                        iny
                                        dex
                                bpl :-
                                tya
                                clc
                                adc z1+0
                                sta z1+0
                                bcc :+
                                        inc z1+1
                                :
                                rts
.endproc


The handler for template 18 (for self moding the template before instancing):
.proc templateHandler18
                                sta template18+2
                                adc #8
                                sta template18+6
                                lda (z2),y
                                iny
                                sta template18+4
                                lda (z2),y
                                iny
                                sta template18+8
                                lda (z2),y
                                iny
                                sta template18+12
                                rts
.endproc


Template18:
template18:             sec
                                lda $00
                                sbc #$00
                                lda $00
                                sbc #$00
                                bpl :+
                                        inc visibleNormals
                                :
template18_end:


Byte code for one of the objects:
bytecode:
             .byte $02,$2d,$04,$5d,$0e,$87,$09,$02,$3d,$04,$6d,$0e,$97,$0b,$02,$4d,$04,$7d,$0e,$a7, $0d,$10,$00,$00,$2d,$04,$5d,$0
             .byte $04,$6d,$0e,$97,$0b,$00,$4d,$04,$7d,$0e,$a7,$0d,$10,$01,$09,$5d,$0e,$87,$09,$09, $6d,$0e,$97,$0b,$09,$7d,$0e,$a
             .byte $27,$08,$5b,$0e,$87,$09,$02,$37,$08,$6b,$0e,$97,$0b,$02,$47,$08,$7b,$0e,$a7,$0d, $10,$03,$00,$2a,$04,$5b,$0e,$8
             .byte $6b,$0e,$97,$0b,$00,$4a,$04,$7b,$0e,$a7,$0d,$10,$04,$02,$2a,$04,$5b,$0e,$87,$09, $02,$3a,$04,$6b,$0e,$97,$0b,$0
             .byte $a7,$0d,$10,$05,$02,$27,$08,$57,$0e,$87,$09,$02,$37,$08,$67,$0e,$97,$0b,$02,$47, $08,$77,$0e,$a7,$0d,$10,$06,$0
             .byte $87,$09,$02,$38,$08,$69,$0e,$97,$0b,$02,$48,$08,$79,$0e,$a7,$0d,$10,$07,$02,$2d, $04,$5d,$0c,$87,$09,$02,$3d,$0
             .byte $02,$4d,$04,$7d,$0c,$a7,$0d,$10,$08,$00,$2d,$04,$5d,$0c,$87,$09,$00,$3d,$04,$6d, $0c,$97,$0b,$00,$4d,$04,$7d,$0
             .byte $09,$5d,$0c,$87,$09,$09,$6d,$0c,$97,$0b,$09,$7d,$0c,$a7,$0d,$10,$0a,$02,$27,$08, $5b,$0c,$87,$09,$02,$37,$08,$6
             .byte $47,$08,$7b,$0c,$a7,$0d,$10,$0b,$00,$2a,$04,$5b,$0c,$87,$09,$00,$3a,$04,$6b,$0c, $97,$0b,$00,$4a,$04,$7b,$0c,$a
             .byte $2a,$04,$5b,$0c,$87,$09,$02,$3a,$04,$6b,$0c,$97,$0b,$02,$4a,$04,$7b,$0c,$a7,$0d, $10,$0d,$02,$27,$08,$57,$0c,$8
             .byte $67,$0c,$97,$0b,$02,$47,$08,$77,$0c,$a7,$0d,$10,$0e,$02,$28,$08,$59,$0c,$87,$09, $02,$38,$08,$69,$0c,$97,$0b,$0
             .byte $a7,$0d,$10,$0f,$00,$2b,$04,$5d,$0e,$87,$09,$00,$3b,$04,$6d,$0e,$97,$0b,$00,$4b, $04,$7d,$0e,$a7,$0d,$10,$10,$0
             .byte $87,$09,$00,$3b,$04,$6d,$0c,$97,$0b,$00,$4b,$04,$7d,$0c,$a7,$0d,$10,$11,$21,$a7, $04,$00,$d0,$20,$a7,$fc,$ff,$d
             .byte $de,$ff,$d2,$11,$48,$16,$77,$0e,$00,$d3,$11,$48,$18,$77,$04,$00,$d4,$13,$48,$18, $77,$de,$ff,$d5,$1a,$77,$de,$f
             .byte $77,$f2,$ff,$d7,$1c,$77,$e8,$ff,$d8,$13,$48,$18,$79,$22,$00,$d9,$11,$48,$18,$77, $de,$ff,$da,$13,$48,$16,$77,$0
 
2016-01-27 02:25
chatGPZ

Registered: Dec 2001
Posts: 11386
jackasser wins :)
2016-01-27 06:02
Oswald

Registered: Apr 2002
Posts: 5094
yup he does, I'm also for realtime speedcode generators. once you have a good basis down, its about as easy to tweak them than higher level generators.
2016-01-27 06:10
ChristopherJam

Registered: Aug 2004
Posts: 1409
Thirded. JackAsser's code is definitely makes for a better final result, I'm just lazy.
2016-01-27 07:41
HCL

Registered: Feb 2003
Posts: 728
Damn :). I also use code generators for the last 15 years or so, but i never took it one step further like Jackasser :P. I feel lame.
2016-01-27 07:47
Frantic

Registered: Mar 2003
Posts: 1648
@HCL: Would you have admitted to feeling lame if the two of you were not in the same group? ;)
2016-01-27 08:44
HCL

Registered: Feb 2003
Posts: 728
@Frantic: Probably not. Don't fuck'n push me with philosofical off-topic questions ;).
2016-01-27 08:46
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: jackasser wins :)

It's not about winning, it's about not getting kicked out of Booze. I always use the macro assembler or code generators written in C or Java when developing for speed and ease to tweak. However, delivering a part for linking like that would kill the loading times and HCL would kick me out with my head first, down some random stair. That could very well happen anyway, since I havn't delivered a single part the last year or so. :/
Previous - 1 | ... | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Neon Vincent
Guests online: 132
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.055 sec.