first commit
This commit is contained in:
101
main.s
Normal file
101
main.s
Normal file
@@ -0,0 +1,101 @@
|
||||
; 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
|
||||
|
||||
MAIN_LOOP:
|
||||
; Wait for vertical blank
|
||||
bsr WaitVBlank
|
||||
|
||||
; 1. Read Input
|
||||
bsr ReadInput
|
||||
|
||||
; 2. Update Game Logic
|
||||
bsr UpdateGame
|
||||
|
||||
; 3. Check for Exit (Left Mouse Button for now)
|
||||
btst #6,CIAA
|
||||
bne.s MAIN_LOOP
|
||||
|
||||
EXIT:
|
||||
; Restore System
|
||||
lea CUSTOM,a6
|
||||
move.w #$7FFF,DMACON(a6)
|
||||
move.w #$7FFF,INTENA(a6)
|
||||
|
||||
move.w OldDmaCon,DMACON(a6)
|
||||
move.w OldIntEna,INTENA(a6)
|
||||
|
||||
; Enable multitasking
|
||||
; move.l 4.w,a6
|
||||
; jsr -138(a6) ; Permit
|
||||
|
||||
moveq #0,d0
|
||||
rts
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Helper Routines
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
WaitVBlank:
|
||||
lea CUSTOM,a6
|
||||
.wait:
|
||||
move.l $04(a6),d0
|
||||
and.l #$1ff00,d0
|
||||
cmp.l #300<<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
|
||||
Reference in New Issue
Block a user