; Amiga 500 Email Game - Main Entry Point ; --------------------------------------------------------------------------- INCDIR "c:/Users/capitano/Documents/giochino/" INCLUDE "custom.i" ; SECTION Code,CODE_C ; Load address for the game (must match bootblock) ORG $20000 START: ; Initialize Stack Pointer to safe area (64KB above game start) ; Stack grows downward, so we put it well above our code lea $30000,sp ; Don't take over the system completely - stay system friendly ; move.l 4.w,a6 ; ExecBase ; jsr -132(a6) ; Forbid (disable multitasking) ; Save old view lea CUSTOM,a6 move.w INTENAR(a6),d0 or.w #$8000,d0 move.w d0,OldIntEna move.w DMACONR(a6),d0 or.w #$8000,d0 move.w d0,OldDmaCon ; Disable all interrupts and DMA move.w #$7FFF,INTENA(a6) move.w #$7FFF,DMACON(a6) move.w #$7FFF,INTREQ(a6) ; Initialize Subsystems bsr InitGraphics bsr InitGameLogic ; Enable DMA for Copper, Bitplanes, Blitter move.w #$83C0,DMACON(a6) ; Set DMAEN, BPLEN, COPEN, BLTEN move.w #0,COPJMP1(a6) ; Strobe Copper to start immediately MAIN_LOOP: ; Wait for vertical blank bsr WaitVBlank ; 1. Read Input bsr ReadInput ; 2. Update Game Logic bsr UpdateGame ; 3. Check for Reset (Left Mouse Button) btst #6,CIAA bne.s MAIN_LOOP ; If button pressed, restart game bra START ; EXIT label removed as we don't return to OS ; The bootblock environment has no OS to return to cleanly in this simple setup ; --------------------------------------------------------------------------- ; Helper Routines ; --------------------------------------------------------------------------- WaitVBlank: lea CUSTOM,a6 .wait: move.l $04(a6),d0 and.l #$1ff00,d0 cmp.l #250<<8,d0 bne.s .wait rts ; --------------------------------------------------------------------------- ; Included Modules ; --------------------------------------------------------------------------- INCLUDE "graphics.s" INCLUDE "game_logic.s" INCLUDE "input.s" INCLUDE "data.s" ; --------------------------------------------------------------------------- ; Data ; --------------------------------------------------------------------------- ; SECTION Data,DATA_C OldIntEna: dc.w 0 OldDmaCon: dc.w 0 END