; Provided under the CC0 license. See the included LICENSE.txt for details. START start ;******** more or less the Atari recommended startup procedure sei cld ifnconst NOTIALOCK lda #$07 else lda #$06 endif sta INPTCTRL ;lock 7800 into 7800 mode lda #$7F sta CTRL ;disable DMA lda #$00 sta OFFSET ifnconst NOTIALOCK sta INPTCTRL sta BACKGRND ; black default, in case a flash cart is using something else endif ldx #$FF txs ;************** Clear Memory ; ** Clear 1800-27FF, pg0+pg1 memory. ClearMemPages lda #0 tay ; y=0 sta $80 ldx #$18 ClearMemPagesLoop stx $81 ; needed for when we step on ZP memory sta ($80),y ;Store data iny ;Next byte bne ClearMemPagesLoop inx cpx #$28 bne ClearMemPagesLoop sta $81 ;seed random number with hopefully-random timer value lda #1 ora INTIM sta rand ; detect the console type... pndetectvblankstart lda MSTAT bpl pndetectvblankstart ; if we're not in VBLANK, wait for it to start pndetectvblankover lda MSTAT bmi pndetectvblankover ; then wait for it to be over ldy #$00 ldx #$00 pndetectvblankhappening lda MSTAT bmi pndetectinvblank ; if VBLANK starts, exit our counting loop sta WSYNC sta WSYNC inx bne pndetectvblankhappening pndetectinvblank cpx #125 bcc pndetecispal ldy #$01 pndetecispal sty paldetected jsr createallgamedlls lda #>DLLMEM sta DPPH lda #