mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-09-12 01:52:10 +00:00
First pass at workbench compatible version
This commit is contained in:
+4
-2
@@ -1,3 +1,4 @@
|
|||||||
|
TRACKLOADER=1
|
||||||
EXAMPLE_NAME=game1
|
EXAMPLE_NAME=game1
|
||||||
BACKGROUND_COLOR=09e
|
BACKGROUND_COLOR=09e
|
||||||
BACKGROUND_GREY_COLOR=777
|
BACKGROUND_GREY_COLOR=777
|
||||||
@@ -81,7 +82,7 @@ IMAGES=foreground.png \
|
|||||||
|
|
||||||
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
|
IMAGEDATA=$(addprefix out/, $(IMAGES:.png=.bin))
|
||||||
|
|
||||||
VASM_EXTRA_ARGS=-DSFX=1 -DMAX_P61_SIZE=$(MAX_P61_SIZE) -allmp
|
VASM_EXTRA_ARGS=-DSFX=1 -DMAX_P61_SIZE=$(MAX_P61_SIZE) -allmp -DTRACKLOADER=$(TRACKLOADER)
|
||||||
|
|
||||||
LINKER_OPTIONS=-T link.script.x
|
LINKER_OPTIONS=-T link.script.x
|
||||||
|
|
||||||
@@ -296,4 +297,5 @@ out/main.o: $(IMAGEDATA) \
|
|||||||
out/panelFade.s out/jump.raw out/falling.raw out/chaching.raw out/whoosh.raw out/yay.raw
|
out/panelFade.s out/jump.raw out/falling.raw out/chaching.raw out/whoosh.raw out/yay.raw
|
||||||
|
|
||||||
|
|
||||||
|
out/main.exe: out/main.o $(OBJS)
|
||||||
|
vlink -hunkattr DATA=2 -hunkattr CODE=2 -hunkattr .text=2 -hunkattr .code=2 -hunkattr .data=2 -hunkattr .noload=2 -hunkattr .bss=2 $< $(OBJS) -o $@
|
||||||
+14
-2
@@ -1,10 +1,12 @@
|
|||||||
xdef LoadDiskData
|
xdef LoadDiskData
|
||||||
|
|
||||||
|
|
||||||
LoadDiskData:
|
LoadDiskData:
|
||||||
;; a0 - destination address
|
;; a0 - destination address
|
||||||
;; a1 - start address
|
;; a1 - start address
|
||||||
;; d0 - size
|
;; d0 - size
|
||||||
movem.l d0-a6,-(sp)
|
movem.l d0-a6,-(sp)
|
||||||
|
if TRACKLOADER=1
|
||||||
lea $dff002,a6 ; LoadMFMB uses this custom base addr
|
lea $dff002,a6 ; LoadMFMB uses this custom base addr
|
||||||
|
|
||||||
move.l d0,d1
|
move.l d0,d1
|
||||||
@@ -22,6 +24,16 @@ LoadDiskData:
|
|||||||
lsr.l #3,d1
|
lsr.l #3,d1
|
||||||
neg.w d1
|
neg.w d1
|
||||||
jsr LoadMFMB ; load the data!
|
jsr LoadMFMB ; load the data!
|
||||||
|
else
|
||||||
|
|
||||||
|
lsr.l #2,d0
|
||||||
|
sub.l #1,d0
|
||||||
|
.loop:
|
||||||
|
move.l (a1)+,(a0)+
|
||||||
|
dbra d0,.loop
|
||||||
|
|
||||||
|
endif
|
||||||
movem.l (sp)+,d0-a6
|
movem.l (sp)+,d0-a6
|
||||||
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|||||||
+54
-3
@@ -36,24 +36,43 @@
|
|||||||
xdef levelInstallers
|
xdef levelInstallers
|
||||||
xdef tutorialLevelInstallers
|
xdef tutorialLevelInstallers
|
||||||
|
|
||||||
|
if TRACKLOADER=1
|
||||||
byteMap:
|
byteMap:
|
||||||
dc.l Entry
|
dc.l Entry
|
||||||
dc.l endCode-byteMap
|
dc.l endCode-byteMap
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
Entry:
|
Entry:
|
||||||
|
if TRACKLOADER=0
|
||||||
|
jmp StartupFromOS
|
||||||
|
Entry2:
|
||||||
lea userstack,a7
|
lea userstack,a7
|
||||||
|
endif
|
||||||
|
|
||||||
lea CUSTOM,a6
|
lea CUSTOM,a6
|
||||||
|
|
||||||
move #$7ff,DMACON(a6) ; disable all dma
|
move #$7ff,DMACON(a6) ; disable all dma
|
||||||
move #$7fff,INTENA(a6) ; disable all interrupts
|
move #$7fff,INTENA(a6) ; disable all interrupts
|
||||||
|
|
||||||
|
jsr WaitVerticalBlank
|
||||||
|
|
||||||
|
move.w #$7FFF,d0
|
||||||
|
move.w d0,$9A(a6) ; Disable Interrupts
|
||||||
|
move.w d0,$96(a6) ; Clear all DMA channels
|
||||||
|
move.w d0,$9C(a6) ; Clear all INT requests
|
||||||
|
move.w d0,$9C(a6) ; Clear all INT requests
|
||||||
|
|
||||||
|
move.w #$0C00,$106(a6) ;BPLCON3
|
||||||
|
move.w #$0011,$10C(a6) ;BPLCON4
|
||||||
|
|
||||||
lea Level3InterruptHandler,a3
|
lea Level3InterruptHandler,a3
|
||||||
move.l a3,LVL3_INT_VECTOR
|
move.l a3,LVL3_INT_VECTOR
|
||||||
|
|
||||||
move.w #0,d0
|
move.w #0,d0
|
||||||
jsr StartMusic
|
jsr StartMusic
|
||||||
jsr ShowSplash
|
jsr ShowSplash
|
||||||
|
|
||||||
MainMenu:
|
MainMenu:
|
||||||
jsr ShowMenu
|
jsr ShowMenu
|
||||||
|
|
||||||
@@ -829,6 +848,36 @@ BlitCountdown:
|
|||||||
move.l a1,BLTDPTH(a6) ;destination top left corner
|
move.l a1,BLTDPTH(a6) ;destination top left corner
|
||||||
move.w #(12*PANEL_BIT_DEPTH)<<6|(COUNTDOWN_BLIT_WIDTH_WORDS),BLTSIZE(a6)
|
move.w #(12*PANEL_BIT_DEPTH)<<6|(COUNTDOWN_BLIT_WIDTH_WORDS),BLTSIZE(a6)
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
if TRACKLOADER=0
|
||||||
|
; from Photon http://coppershade.org/asmskool/SOURCES/Developing-Demo-Effects/DDE2/Coppershade-DDE2/PhotonsMiniWrapper1.04!.S
|
||||||
|
StartupFromOS:
|
||||||
|
move.l 4.w,a6 ;Exec library base address in a6
|
||||||
|
sub.l a4,a4
|
||||||
|
btst #0,297(a6) ;68000 CPU?
|
||||||
|
beq.s .yes68k
|
||||||
|
lea .GetVBR(pc),a5 ;else fetch vector base address to a4:
|
||||||
|
jsr -30(a6) ;enter Supervisor mode
|
||||||
|
;; *--- save view+coppers ---*
|
||||||
|
.yes68k:
|
||||||
|
lea .GfxLib(pc),a1 ;either way return to here and open
|
||||||
|
jsr -408(a6) ;graphics library
|
||||||
|
tst.l d0 ;if not OK,
|
||||||
|
beq.s .quit ;exit program.
|
||||||
|
move.l d0,a5 ;a5=gfxbase
|
||||||
|
move.l a5,a6
|
||||||
|
move.l 34(a6),-(sp)
|
||||||
|
sub.l a1,a1 ;blank screen to trigger screen switch
|
||||||
|
jsr -222(a6) ;on Amigas with graphics cards
|
||||||
|
jmp Entry2
|
||||||
|
|
||||||
|
.quit: moveq #0,d0 ;clear error return code to OS
|
||||||
|
rts
|
||||||
|
|
||||||
|
.GfxLib:dc.b "graphics.library",0,0
|
||||||
|
.GetVBR:dc.w $4e7a,$c801 ;hex for "movec VBR,a4"
|
||||||
|
rte
|
||||||
|
endif
|
||||||
|
|
||||||
;; variable prefix
|
;; variable prefix
|
||||||
;; level name
|
;; level name
|
||||||
@@ -987,13 +1036,13 @@ nextLevelInstaller:
|
|||||||
|
|
||||||
tutorialLevelInstallers:
|
tutorialLevelInstallers:
|
||||||
dc.l InstallLevel91
|
dc.l InstallLevel91
|
||||||
endTutorialLevelInstaller:
|
|
||||||
dc.l InstallLevel92
|
dc.l InstallLevel92
|
||||||
dc.l InstallLevel93
|
dc.l InstallLevel93
|
||||||
dc.l InstallLevel94
|
dc.l InstallLevel94
|
||||||
dc.l InstallLevel95
|
dc.l InstallLevel95
|
||||||
dc.l InstallLevel96
|
dc.l InstallLevel96
|
||||||
dc.l InstallLevel97
|
dc.l InstallLevel97
|
||||||
|
endTutorialLevelInstaller:
|
||||||
dc.l 0
|
dc.l 0
|
||||||
panelFade:
|
panelFade:
|
||||||
include "out/panelFade.s"
|
include "out/panelFade.s"
|
||||||
@@ -1065,9 +1114,11 @@ livesCounterShortText:
|
|||||||
stopScrollingPending:
|
stopScrollingPending:
|
||||||
dc.w 0
|
dc.w 0
|
||||||
freezeCountdownCounter:
|
freezeCountdownCounter:
|
||||||
dc.w 0
|
dc.w 0
|
||||||
|
if TRACKLOADER=0
|
||||||
startUserstack:
|
startUserstack:
|
||||||
ds.b $1000 ; size of stack
|
ds.b $1000 ; size of stack
|
||||||
userstack:
|
userstack:
|
||||||
|
endif
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
IFND EXEC_EXEC_I
|
||||||
|
include "exec/exec.i"
|
||||||
|
ENDC
|
||||||
|
IFND LIBRARIES_DOSEXTENS_I
|
||||||
|
include "libraries/dosextens.i"
|
||||||
|
ENDC
|
||||||
|
|
||||||
|
|
||||||
|
_LVOForbid EQU -132
|
||||||
|
_LVOFindTask EQU -294
|
||||||
|
_LVOGetMsg EQU -372
|
||||||
|
_LVOReplyMsg EQU -378
|
||||||
|
_LVOWaitPort EQU -384
|
||||||
|
|
||||||
|
movem.l d0/a0,-(sp) save initial values
|
||||||
|
clr.l returnMsg
|
||||||
|
|
||||||
|
sub.l a1,a1
|
||||||
|
move.l 4.w,a6
|
||||||
|
jsr _LVOFindTask(a6) find us
|
||||||
|
move.l d0,a4
|
||||||
|
|
||||||
|
tst.l pr_CLI(a4)
|
||||||
|
beq.s fromWorkbench
|
||||||
|
|
||||||
|
* we were called from the CLI
|
||||||
|
movem.l (sp)+,d0/a0 restore regs
|
||||||
|
bra end_startup and run the user prog
|
||||||
|
|
||||||
|
* we were called from the Workbench
|
||||||
|
fromWorkbench:
|
||||||
|
lea pr_MsgPort(a4),a0
|
||||||
|
move.l 4.w,a6
|
||||||
|
jsr _LVOWaitPort(A6) wait for a message
|
||||||
|
lea pr_MsgPort(a4),a0
|
||||||
|
jsr _LVOGetMsg(A6) then get it
|
||||||
|
move.l d0,returnMsg save it for later reply
|
||||||
|
|
||||||
|
* do some other stuff here RSN like the command line etc
|
||||||
|
nop
|
||||||
|
|
||||||
|
movem.l (sp)+,d0/a0 restore
|
||||||
|
end_startup:
|
||||||
|
bsr.s Entry call our program
|
||||||
|
|
||||||
|
* returns to here with exit code in d0
|
||||||
|
move.l d0,-(sp) save it
|
||||||
|
|
||||||
|
tst.l returnMsg
|
||||||
|
beq.s exitToDOS if I was a CLI
|
||||||
|
|
||||||
|
move.l 4.w,a6
|
||||||
|
jsr _LVOForbid(a6)
|
||||||
|
|
||||||
|
move.l returnMsg(pc),a1
|
||||||
|
jsr _LVOReplyMsg(a6)
|
||||||
|
|
||||||
|
exitToDOS:
|
||||||
|
move.l (sp)+,d0 exit code
|
||||||
|
rts
|
||||||
|
|
||||||
|
* startup code variable
|
||||||
|
returnMsg: dc.l 0
|
||||||
|
|
||||||
Reference in New Issue
Block a user