Jump to content

7800 programming


Recommended Posts

Not to sound to geeky but it's neat how the 7800 hardware works,I've been doing graphic by hand in binary are their tools to speed this up for developers?I could continue hand writing out the binary but it's a very slow process.Any tools that can export the binary anyone can suggest?I found Atariboy2600's Tron mockups that I've been using with some adjustments.




  • Like 4
Link to comment
Share on other sites

1 hour ago, Muddyfunster said:

I tend to do all of my programming in 7800Basic so adding graphics is just a matter of importing .png files. I use a combination of ADS (Atari Dev Studio) as my IDE and the built in sprite editor. For more complex stuff and animation I use GiMP (more recently been testing Aseprite).

Thanks for reply Muddy,I won't be using 7800basic but I plan on having a look into it just because I read RevEng said things can be done under the hood(asm)

Edited by Traxx
  • Like 3
Link to comment
Share on other sites

  • 4 weeks later...

Since I find it extremely difficult to draw pixels in double width I've started porting Vs Gong Fight to nes,I figure once I have all code and logic complete I can then start taking time to convert graphics over.Just started but you can move around and use straight punch & uppercut.




Vs Gong Fight Nes


Edited by Traxx
  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...

By the way, here is the source code:

    processor 6502

INPTCTRL        equ     $01     ;Input control
AUDC0           equ     $15     ;Audio Control Channel 0
AUDC1           equ     $16     ;Audio Control Channel 1
AUDF0           equ     $17     ;Audio Frequency Channel 0
AUDF1           equ     $18     ;Audio Frequency Channel 1
AUDV0           equ     $19     ;Audio Volume Channel 0
AUDV1           equ     $1A     ;Audio Volume Channel 1
INPT0           equ     $08     ;Paddle Control Input 0
INPT1           equ     $09     ;Paddle Control Input 1
INPT2           equ     $0A     ;Paddle Control Input 2
INPT3           equ     $0B     ;Paddle Control Input 3
INPT4           equ     $0C     ;Player 0 Fire Button Input
INPT5           equ     $0D     ;Player 1 Fire Button Input

BACKGRND        equ     $20     ;Background Color
P0C1            equ     $21     ;Palette 0 - Color 1
P0C2            equ     $22     ;Palette 0 - Color 2
P0C3            equ     $23     ;Palette 0 - Color 3
WSYNC           equ     $24     ;Wait For Sync
P1C1            equ     $25     ;Palette 1 - Color 1
P1C2            equ     $26     ;Palette 1 - Color 2
P1C3            equ     $27     ;Palette 1 - Color 3
MSTAT           equ     $28     ;Maria Status
P2C1            equ     $29     ;Palette 2 - Color 1
P2C2            equ     $2A     ;Palette 2 - Color 2
P2C3            equ     $2B     ;Palette 2 - Color 3
DPPH            equ     $2C     ;Display List List Pointer High
P3C1            equ     $2D     ;Palette 3 - Color 1
P3C2            equ     $2E     ;Palette 3 - Color 2
P3C3            equ     $2F     ;Palette 3 - Color 3
DPPL            equ     $30     ;Display List List Pointer Low
P4C1            equ     $31     ;Palette 4 - Color 1
P4C2            equ     $32     ;Palette 4 - Color 2
P4C3            equ     $33     ;Palette 4 - Color 3
CHARBASE        equ     $34     ;Character Base Address
P5C1            equ     $35     ;Palette 5 - Color 1
P5C2            equ     $36     ;Palette 5 - Color 2
P5C3            equ     $37     ;Palette 5 - Color 3
OFFSET          equ     $38     ;Unused - Store zero here
P6C1            equ     $39     ;Palette 6 - Color 1
P6C2            equ     $3A     ;Palette 6 - Color 2
P6C3            equ     $3B     ;Palette 6 - Color 3
CTRL            equ     $3C     ;Maria Control Register
P7C1            equ     $3D     ;Palette 7 - Color 1
P7C2            equ     $3E     ;Palette 7 - Color 2
P7C3            equ     $3F     ;Palette 7 - Color 3

SWCHA           equ     $280    ;P0, P1 Joystick Directional Input
SWCHB           equ     $282    ;Console Switches
CTLSWA          equ     $281    ;I/O Control for SCHWA
CTLSWB          equ     $283    ;I/O Control for SCHWB
Pokey    equ $400
PAUDF0   = Pokey    ; extra audio channels and frequencies
PAUDC0   = Pokey+1
PAUDF1   = Pokey+2
PAUDC1   = Pokey+3
PAUDF2   = Pokey+4
PAUDC2   = Pokey+5
PAUDF3   = Pokey+6
PAUDC3   = Pokey+7
PAUDCTL  = Pokey+8 ; Audio Control
PRANDOM  = Pokey+10    ; 17 bit polycounter pseudo random
PSKCTL   = Pokey+16    ; Serial Port control
    SEG.U data
    org $40;Fast-ram!

dlend    ds.b    13        ;Index of end of each DL
ypos2 org $51
tempoffset org $52
tempval org $53
tempdlend    org $54
tempzone    org $55
currspr    org $56; current object being processed
    org $57
xpos    ds.b    1              ;X Position of sprite
ypos    ds.b    1                ;Y Position of sprite
temp    ds.b    1        
dlpnt    ds.w    1
    org $5C
    org $1825
XPOS    org $1830
YPOS    org $1840
GFXLO    org $1850
GFXHI    org $1860
PALWDH    org $1870
    SEG code
        org $4000
;************** Clear zero page and hardware ******

    ldx     #$40
    lda     #$00
    sta     $00,x           ;Clear zero page
    sta    $100,x        ;Clear page 1
    bne     crloop1

        ldy     #$00            ;Clear Ram
        sta    $1800,y
        sta    $1900,y
        sta    $1a00,y
        sta    $1b00,y
        sta    $1c00,y
        sta    $1d00,y
        sta    $1e00,y
        sta    $1f00,y
        sta    $2200,y
        sta    $2300,y
        sta    $2400,y
        sta    $2500,y
        sta    $2600,y
        sta    $2700,y
        bne    crloop2

        lda     #$07
    sta     INPTCTRL        ;Lock into 7800 mode
    lda     #$7F
    sta     CTRL            ;Disable DMA
    lda     #$00            
    sta     OFFSET
    sta     INPTCTRL
    ldx     #$FF            ;Reset stack pointer
        lda #%01010011
        sta CTRL
        lda #$18; DLL starts at "1800"
        sta DPPH
        lda #$00
        sta DPPL
        lda #%01001111
        sta $1800; Tell MARIA (GFX CHIP) that "Sprite one's DL is 
        lda #$18; at $1803 and that it uses 16 pixel high holey
        sta $1801; DMA."
        lda #$03
        sta $1802
        lda #$0F
        sta P0C1; Set Player 0 color 2 to "White"
        sta P0C2
        ldx #$00
        stx ypos
        stx xpos
        stx GFXLO
        stx GFXLO+1
        lda #$a0
        sta GFXHI
        sta GFXHI+1
        lda #$40
        sta XPOS+1
        sta YPOS+1
                ldy     #$00
        lda     #$4F            ;16 lines
        sta     $1800,x        
        lda     DLPOINTH,y
        sta    $1800,x
        lda     DLPOINTL,y
        sta    $1800,x
        cpy     #$0D            ;12 DLL entries
        bne     DLLloop2
        lda #$40
        sta xpos
        sta YPOS
        lda #$1F
        sta PALWDH
        sta PALWDH+1
        lda    MSTAT        ;Wait for VBLANK
    and #$80
        beq Mainloop

    lda #0
        sta currspr
        lda #2
        sta numspr
    lda    SWCHA        ;Read stick
    and    #$80        ;Pushed Right?
    bne    skip1
    ldx    XPOS        ;Move sprite to right
    stx    XPOS
    lda    SWCHA        ;Read stick
    and     #$40        ;Pushed Left?
    bne     skip2
    ldx     XPOS        ;Move sprite to left
    stx     XPOS
        lda     SWCHA        ;Read stick
        and     #$20        ;Pushed Down?
        bne     skip3        
        ldx     YPOS        ;Move sprite down
        cpx    #176    
        beq    skip3        ;Don't move if we are at the bottom
        stx     YPOS    
        lda     SWCHA        ;Read stick
        and     #$10        ;Pushed Up?
        bne     skip4        
        ldx     YPOS        ;Move sprite up
        beq    skip4        ;Don't move if we are at the top
        stx     YPOS
        lda #0
        ldx #$0C
cleardlend        sta dlend,x; set all dlends to 0
        bne cleardlend
    ;format = 
        ; 1: low adress
        ; 2 : write mode on 7, indirect mode on 5
        ; 3 : High adress + lower nybble of y pos
        ; 4 = pallete + width
        ; 5 = xpos
        ldx currspr; 3
        lda YPOS,x; 7
        and #$0F; 9
        sta tempoffset; 12
        lda YPOS,x; 16
        lsr; 18
        lsr; 20
        lda DLPOINTH,x;    33
        sta dlpnt+1; 36
        lda DLPOINTL,x;    40
        sta dlpnt;    43
        ldy dlend,x;    47
        stx tempzone;    50
        ldx currspr; which sprite to process?    53
        lda GFXLO,x; low byte    57
        sta (dlpnt),y;    63
        iny;                    65
        lda #$40; write mode            67
        sta (dlpnt),y;                73
        iny;                    75
        lda GFXHI,x; high byte + low nybble of ypos    79
        ora tempoffset;                82
        sta (dlpnt),y;                88
        iny;                    90
        lda PALWDH,x; pallete and width        94
        sta (dlpnt),y;                100
        iny;                    102
        lda XPOS,x; xpos             106
        sta (dlpnt),y;                112
        ldx tempzone;                115
        sty dlend,x;                119
        lda tempoffset;                122
        beq nobottom; don't draw bottom        124
        inx;                    126
        lda DLPOINTH,x;                130
        sta dlpnt+1;                133
        lda DLPOINTL,x;                137
        sta dlpnt;                140
        ldy dlend,x;                144
        stx tempzone; save the current zone    147
        ldx currspr; which sprite to process?    150
        lda GFXLO,x;                154
        sta (dlpnt),y;                160
        iny;                    162
        lda #$40;                164
        sta (dlpnt),y;                170
        iny;                    172
        lda    tempoffset;            175
    eor    #$0F;                177
    sta    temp; to do the bottom, we need some extra 180
    lda    GFXHI,x; computations! grr!    184
    clc;                    186
    sbc     temp;                189
    sta     (dlpnt),y;            195
        iny;                    197
        lda PALWDH,x;                201
        sta (dlpnt),y;                207
        iny;                    209
        lda XPOS,x;                213
        sta (dlpnt),y;                219
        ldx tempzone;                222
        sty dlend,x;                226
    inc currspr;                231, 129
        lda currspr;                234, 132
        cmp numspr;                237, 135
        beq dontmakegfx;            239, 137
        jmp makegfx;                242, 140
    ldx    #$0C
    lda    DLPOINTL,x
    sta    dlpnt
    lda    DLPOINTH,x
       sta    dlpnt+1
       ldy     dlend,x
       lda    #$0
       sta    (dlpnt),y
    bne     dlendloop   
    lda    MSTAT        ;Wait for VBLANK to end
    and    #$80
    bne     vbloop
        jmp Mainloop
        .byte   $25,$25,$25,$25,$26,$26,$26,$26,$27,$27,$27,$27
        .byte   $00,$40,$80,$C0,$00,$40,$80,$C0,$00,$40,$80,$C0
    org $7FF6; Simple stuff like checking the reset switch.
                    lsr SWCHB    ; test Game Reset switch
        bcc start
start    jmp start
        org $7FFF
        byte #$00; if this isn't a 0, this means this is 
    org $a000; being run on something other than an official
        .byte     %00111100; cartridge.
        org $a100
        .byte     %00111100
        org $a200
        .byte     %01000010 
        org $a300
        .byte     %01000010 
        org $a400
        .byte     %10011001
        org $a500
        .byte     %10011001
        org $a600
        .byte     %10100101
        org $a700
        .byte     %10100101
        org $a800
        .byte     %10000001
        org $a900
        .byte     %10000001
        org $aA00
        .byte     %10100101
        org $aB00
        .byte     %10100101
        org $aC00
        .byte     %01000010
        org $aD00
        .byte     %01000010
        org $aE00
        .byte     %00111100
        org $aF00
        .byte     %00111100
         org     $fff8
    .byte   $FF         ;Region verification
    .byte   $87         ;ROM start $4000
    .word   #NMI
    .word   #START
    .word   #IRQ


Link to comment
Share on other sites

This works with 8bitworkshop: here's a link!

8bitworkshop IDE [atari7800] - sprites.dasm

You can copy my source code, make a new file on 8bitwokshop (I'll abreviate it as 8bws), and paste in the code. You can also make a "jsr" to the part making the sprites. There is some glitching at the bottom of the screen. An updated source would be greatly appreciated!

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...