+Karl G Posted March 24, 2021 Share Posted March 24, 2021 I love 7800Basic, but I am wanting to understand more about making 7800 games in assembly. I'm aware of the 7800 Software Guide for technical information, but does there exist a simple "hello world" type of example to help the uninitiated? 3 Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted March 24, 2021 Share Posted March 24, 2021 I used @PacManPlus's DLL Template as a reference point when building the Congo Bongo graphics demo: 5 Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted March 24, 2021 Share Posted March 24, 2021 The closest thing I found when I started to look at the 7800 was this example code that I was then able to modify slightly to have a scrolling tile-map. https://atarihq.com/danb/files/7800sprt.s 6 Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 29, 2021 Share Posted March 29, 2021 On 3/24/2021 at 2:28 PM, SmittyB said: The closest thing I found when I started to look at the 7800 was this example code that I was then able to modify slightly to have a scrolling tile-map. https://atarihq.com/danb/files/7800sprt.s Just a caution for anyone using that code - the "build DL entries" section of code has a bug, which results in the code not correctly building DLs for more than one sprite. Prior to the "sty dlend,x" opcodes near the end of the top sprite update section, and the bottom sprite update section, you need to add an "iny" to get the correct DL ending stored. The original 7800basic sprite DL update was based on Dan's code, but has been quite heavily modified to support different zone heights, vertical masking, double-buffering, etc., in addition to just optimising cycles. 1 3 Quote Link to comment Share on other sites More sharing options...
EricBall Posted April 8, 2021 Share Posted April 8, 2021 IMHO one of the big challenges of programming the 7800 is the amount of data required to get anything to appear on screen - you need to generate the display lists and the display list list. And once you get that done you realize it's non-trivial to dynamically generate those display lists efficiently. 4 Quote Link to comment Share on other sites More sharing options...
+Pat Brady Posted April 8, 2021 Share Posted April 8, 2021 1 hour ago, EricBall said: IMHO one of the big challenges of programming the 7800 is the amount of data required to get anything to appear on screen - you need to generate the display lists and the display list list. And once you get that done you realize it's non-trivial to dynamically generate those display lists efficiently. The obvious way to do it is: for each zone, check whether each dynamic object is in that zone and if so, write the headers for those objects. It is O(zones * dynamic objects). I have not tested how this actually works. It's not great in principle but should be fine for "Hello, world" purposes. Figuring out a better way felt, to me, like a rite of passage for programming the 7800. I don't want to take that away from anybody, but I also don't want to be coy. So I'll put my solution in a spoiler block. Spoiler What I came up with was: Set aside some temporary RAM, one byte for each playfield zone, first used for object counters. Initialize them to 0. For each dynamic object, increment the object counter for each zone it's in. For each playfield zone, write headers for any static objects, skip over enough bytes to later fill in headers for the dynamic objects, write the two-byte terminator, and replace the object counter with the address (low byte) that will contain the zone's first dynamic object's header. For each dynamic object, emplace the header for the object at the zone's address for dynamic headers, then increment that address. "Object" here means something with its own header. In indirect mode, of course, there are multiple characters (aka tiles) per object. Several loops but none are nested. It is O(zones + dynamic objects). My implementation takes about 100 cycles per zone plus 100 cycles per object per zone. In my case, one page is enough for all of the headers. If you have enough zones and objects that the headers don't fit on a single page, the general idea should still work, but you need 2 bytes per zone, to store both bytes of header addresses. 2 Quote Link to comment Share on other sites More sharing options...
EricBall Posted April 9, 2021 Share Posted April 9, 2021 My technique was to loop through the objects then append the entry to the relevant display list(s). Just need to store an offset for the end of each list. But whatever the method you have to transform the Y position to select the correct display list and then the graphics page offset. 1 Quote Link to comment Share on other sites More sharing options...
Eagle Posted April 10, 2021 Share Posted April 10, 2021 https://github.com/tebe6502/Mad-Assembler/tree/master/examples/ATARI7800 1 1 Quote Link to comment Share on other sites More sharing options...
Eagle Posted April 16, 2021 Share Posted April 16, 2021 My version in Mads Hello, World! - JS7800 emulator link https://github.com/tebe6502/Mad-Assembler http://mads.atari8.info/mads_eng.html https://www.wudsn.com/index.php/ide icl 'maria.h' opt f+h- org $40 dest .ds 2 ;2 bytes ORG $8000-128 HEADER .byte 1 ; 0 Header version - 1 byte .by "ATARI7800 " ; 1..16 "ATARI7800 " - 16 bytes .by "Project name " ; 17..48 Cart title - 32 bytes .by "Author " ; 2 line DTA r ($8000) ; 49..52 data length - 4 bytes (Big-endian format) .byte $00,$00 ; 53..54 cart type - 2 bytes .byte 1 ; 55 controller 1 type - 1 byte .byte 0 ; 56 controller 2 type - 1 byte .byte 0 ; 57 0 = NTSC 1 = PAL .byte 0 ; 58 Save data peripheral - 1 byte (version 2) .byte 0,0,0,0 ;ORG HEADER+63 .byte 0 ; 63 Expansion module .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .by "ACTUAL CART DATA STARTS HERE" .macro clear_ram ldy #$00 mwa #:1 dest lda #$00 @ sta (dest),y inw dest lda dest+1 cmp #>[:2+1] bne @- .endm org $8000 fnt ins 'cmc.fnt' ; START sei ;Disable interrupts cld ;Clear decimal mode mva #$07 INPTCTRL mva #$7F CTRL mva #$00 OFFSET mva #$00 INPTCTRL ldx #$FF ;Reset stack pointer txs ;Clear zeropage,stack,RAM clear_ram $42,$FF ;skip $40&$41 (dest) clear_ram $140,$1FF clear_ram $1800,$1FFF clear_ram $2200,$27FF ; copy Display List List To RAM ldy #0 copy mva .adr(DLLs),y DLLs,y+ cpy #.len DLLs bne copy ; mva #<DLLs DPPL\ mva #>DLLs DPPH ;set display list list address jsr WaitVBLANK ;wait until no DMA would happen mva #>fnt CHBASE mva #$40 CTRL ;set colors mva #$00 BACKGRND\ mva #$02 P0C1\ mva #$04 P0C2\ mva #$0c P0C3 jm jmp jm NMI RTI IRQ RTI WaitVBLANK: WaitVBoff: bit MSTAT bmi WaitVBoff WaitVBon: bit MSTAT bpl WaitVBon rts ; RAM ORG $1800,* .local DLLs :2 .byte $0F,>emptyline,<emptyline .byte $07,>line,<line :24 .byte $0F,>emptyline,<emptyline .byte 0 line .byte <text,$60,>text,0,20 emptyline .byte $00,$00 text .sb 'Hello, World! ' .endl ;************** Cart reset vector ************************** ORG $fff8 .byte $FF ;Region verification .byte $87 ;ROM start $8000 .word NMI .word START .word IRQ maria.h helloworld.asm CMC.FNT helloworld.a78 4 Quote Link to comment Share on other sites More sharing options...
JumbleJag Posted August 30, 2021 Share Posted August 30, 2021 (edited) I know a lot of systems hardware, master system,nes,c64,amiga..but the 7800 is extremely different,I have a grasp on on how display is done because of others and sharing source code.Hardware this different can take a few months to a year to learn,but if your and asm programmer a year is nothing. Shout Out To PacManPlus: You're source code has me now into 7800 dev,thanks Bob Edited August 30, 2021 by JumbleJag 4 1 Quote Link to comment Share on other sites More sharing options...
JumbleJag Posted September 6, 2021 Share Posted September 6, 2021 (edited) Does PacManPlus hang out on discord? Edited October 8, 2021 by JumbleJag Quote Link to comment Share on other sites More sharing options...
JumbleJag Posted October 8, 2021 Share Posted October 8, 2021 (edited) Did you get "hello world" working Karl G?I took Bobs example source,rewrote parts and removed sprite handling code,removed the tile and sprite data and included my own.I can send you the source if still interested in asm programming. Edited October 8, 2021 by JumbleJag Quote Link to comment Share on other sites More sharing options...
+Karl G Posted October 9, 2021 Author Share Posted October 9, 2021 On 10/8/2021 at 1:29 PM, JumbleJag said: Did you get "hello world" working Karl G?I took Bobs example source,rewrote parts and removed sprite handling code,removed the tile and sprite data and included my own.I can send you the source if still interested in asm programming. Thanks. I have not revisited it since I posted that. I'll probably get around to it eventually, though. Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted October 16, 2021 Share Posted October 16, 2021 (edited) Thank you for the shoutout! On 9/5/2021 at 10:31 PM, JumbleJag said: Does PacManPlus hang out on discord? Very, very rarely. I'm still figuring out what discord really *is*. Edited October 16, 2021 by PacManPlus 1 Quote Link to comment Share on other sites More sharing options...
JumbleJag Posted October 20, 2021 Share Posted October 20, 2021 Thanks PacManPlus,I'm ok with how the hardware works now,Another dev friend would would ask me "it would be awesome to do 7800 dev" and now it's possible. 2 Quote Link to comment Share on other sites More sharing options...
SlidellMan Posted October 20, 2021 Share Posted October 20, 2021 @PacManPlus Discord is a chat program/Instant Messaging, akin to AIM, Trillian, etc. (Yes, Trillian still exists.) 1 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.