workbench launch option

This commit is contained in:
alpine9000 2016-05-29 13:09:10 +10:00
parent 9747e0ecc0
commit 1f87824976
8 changed files with 2378 additions and 77 deletions

View File

@ -297,5 +297,16 @@ out/main.o: $(IMAGEDATA) \
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 $@
bin/main.exe: $(ALL_OBJS)
vlink -hunkattr DATA=2 -hunkattr CODE=2 -hunkattr .text=2 -hunkattr .code=2 -hunkattr .data=2 -hunkattr .noload=2 -hunkattr .bss=2 $(ALL_OBJS) -o $@
cp $@ ~/A1200
cp $@ ~/A4000
.PHONY: wipe
wipe: clean
mkdir bin
mkdir out
make TRACKLOADER=0 bin/main.exe
.PHONY: wb
wb: wipe bin/main.exe

2176
028.bs/docs/Howtocode5.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,13 @@
include "includes.i"
xdef StartGame
xdef QuitGame
xdef LevelComplete
xdef BigBang
xdef InstallTilePalette
xdef RevealPathway
xdef FreezeScrolling
xdef PostCheckPlayerMiss
xdef pathwayRenderPending
xdef pathwayPlayerTileAddress
@ -43,12 +46,15 @@ byteMap:
endif
include "wbstartup.i"
Entry:
if TRACKLOADER=0
jmp StartupFromOS
Entry2:
lea userstack,a7
else
lea userstack,a7
endif
Entry2:
lea CUSTOM,a6
@ -56,7 +62,7 @@ Entry2:
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
@ -65,17 +71,16 @@ Entry2:
move.w #$0C00,$106(a6) ;BPLCON3
move.w #$0011,$10C(a6) ;BPLCON4
lea Level3InterruptHandler,a3
move.l a3,LVL3_INT_VECTOR
move.w #0,d0
jsr StartMusic
jsr ShowSplash
MainMenu:
jsr ShowMenu
jmp ShowMenu
StartGame:
jsr BlueFill
jsr InitialiseBackground
@ -235,7 +240,8 @@ GameLoop:
.notMoving:
bsr Update
jsr CheckPlayerMiss
jmp CheckPlayerMiss
PostCheckPlayerMiss:
bsr RenderNextForegroundFrame
jsr RenderNextBackgroundFrame
@ -253,9 +259,11 @@ GameLoop:
jsr PlayNextSound
jsr PrepareItemSpriteData
jsr FlashPickup
bra GameLoop
QuitGame:
rts
Update:
jsr UpdatePlayer
@ -849,36 +857,9 @@ BlitCountdown:
move.w #(12*PANEL_BIT_DEPTH)<<6|(COUNTDOWN_BLIT_WIDTH_WORDS),BLTSIZE(a6)
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
include "os.i"
;; variable prefix
;; level name
;; frames before pathway starts fading
@ -1115,7 +1096,7 @@ stopScrollingPending:
dc.w 0
freezeCountdownCounter:
dc.w 0
if TRACKLOADER=0
if TRACKLOADER=1
startUserstack:
ds.b $1000 ; size of stack
userstack:

View File

@ -78,7 +78,7 @@ ReShowMenu:
.wait:
jsr WaitVerticalBlank
jsr _ProcessJoystick
rts
RenderMenu:
@ -120,6 +120,12 @@ RenderMenu:
add.w #16,d1
move.w #(320/2)-(6*8)+4,d0
jsr DrawMaskedText85
if TRACKLOADER=0
lea quit,a1
add.w #16,d1
move.w #(320/2)-(6*8),d0
jsr DrawMaskedText85
endif
rts
MenuUp:
@ -139,7 +145,11 @@ MenuUp:
rts
MenuDown:
cmp.l #creditsTopColor,selectedPtr
if TRACKLOADER=0
cmp.l #quitTopColor,selectedPtr
else
cmp.l #creditsTopColor,selectedPtr
endif
beq .done
PlaySound Jump
move.l selectedPtr,a0
@ -198,7 +208,13 @@ ButtonPressed:
beq .creditsButton
cmp.l #tutorialTopColor,selectedPtr
beq .tutorialButton
if TRACKLOADER=0
cmp.l #quitTopColor,selectedPtr
beq .quitButton
endif
bra .done
.quitButton:
jmp QuitGame
.difficultyButton:
bsr ToggleDifficulty
bra .done
@ -212,10 +228,10 @@ ButtonPressed:
.done:
bra _ProcessJoystick
.playButton:
rts
jmp StartGame
.tutorialButton:
move.l #tutorialLevelInstallers,nextLevelInstaller
rts
jmp StartGame
WaitForButtonRelease:
.joystickPressed:
@ -295,17 +311,17 @@ music:
credits:
dc.b " CREDITS "
dc.b 0
align 4
align 2
musicOn:
dc.b "MUSIC - ON "
dc.b 0
musicOff:
dc.b "MUSIC - OFF "
dc.b 0
if TRACKLOADER=0
quit:
dc.b " QUIT "
dc.b 0
endif
align 4
splashCopperList:
splashCopperListBplPtr:
@ -328,6 +344,7 @@ splashCopperListBplPtr:
playTopColor:
dc.w MENU_SELECTED_TOP_COLOR
dc.w PLAY_COPPER_WORD+(($1000/4)*3),$fffe
dc.w PLAY_COPPER_WORD+(($1000/4)*3),$fffe
dc.w COLOR31
playBottomColor:
dc.w MENU_SELECTED_BOTTOM_COLOR
@ -337,6 +354,7 @@ playBottomColor:
tutorialTopColor:
dc.w MENU_TEXT_COLOR
dc.w PLAY_COPPER_WORD+$1000+(($1000/4)*3),$fffe
dc.w PLAY_COPPER_WORD+$1000+(($1000/4)*3),$fffe
dc.w COLOR31,MENU_TEXT_BOTTOM_COLOR
dc.w PLAY_COPPER_WORD+$2000,$fffe
@ -344,6 +362,7 @@ tutorialTopColor:
levelTopColor:
dc.w MENU_TEXT_COLOR
dc.w PLAY_COPPER_WORD+$2000+(($1000/4)*3),$fffe
dc.w PLAY_COPPER_WORD+$2000+(($1000/4)*3),$fffe
dc.w COLOR31,MENU_TEXT_BOTTOM_COLOR
dc.w PLAY_COPPER_WORD+$3000,$fffe
@ -351,16 +370,27 @@ levelTopColor:
musicTopColor:
dc.w MENU_TEXT_COLOR
dc.w PLAY_COPPER_WORD+$3000+(($1000/4)*3),$fffe
dc.w PLAY_COPPER_WORD+$3000+(($1000/4)*3),$fffe
dc.w COLOR31,MENU_TEXT_BOTTOM_COLOR
dc.w PLAY_COPPER_WORD+$4000,$fffe
dc.w COLOR31
creditsTopColor:
dc.w MENU_TEXT_COLOR
dc.w PLAY_COPPER_WORD+$4000+(($1000/4)*3),$fffe
dc.w PLAY_COPPER_WORD+$4000+(($1000/4)*3),$fffe
dc.w COLOR31,MENU_TEXT_BOTTOM_COLOR
dc.l $fffffffe
dc.w PLAY_COPPER_WORD+$5000,$fffe
dc.w COLOR31
if TRACKLOADER=0
quitTopColor:
dc.w MENU_TEXT_COLOR
dc.w $ffdf,$fffe
dc.w $06df,$fffe
dc.w COLOR31,MENU_TEXT_BOTTOM_COLOR
endif
dc.l $fffffffe
selectedPtr:
dc.l playTopColor

101
028.bs/os.i Normal file
View File

@ -0,0 +1,101 @@
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
*--- save int+dma ---*
lea $dff000,a6
bsr.s WaitEOF ;wait out the current frame
move.l $1c(a6),-(sp) ;save intena+intreq
move.w 2(a6),-(sp) ;and dma
move.l $6c(a4),-(sp) ;and also the VB int vector for sport.
bsr.s AllOff ;turn off all interrupts+DMA
*--- call demo ---*
movem.l a4-a6,-(sp)
jsr Entry2
movem.l (sp)+,a4-a6
*--- restore all ---*
bsr.s WaitEOF ;wait out the demo's last frame
bsr.s AllOff ;turn off all interrupts+DMA
move.l (sp)+,$6c(a4) ;restore VB vector
move.l 38(a5),$80(a6) ;and copper pointers
move.l 50(a5),$84(a6)
addq.w #1,d2 ;$7fff->$8000 = master enable bit
or.w d2,(sp)
move.w (sp)+,$96(a6) ;restore DMA
or.w d2,(sp)
move.w (sp)+,$9a(a6) ;restore interrupt mask
or.w (sp)+,d2
bsr.s IntReqD2 ;restore interrupt requests
move.l a5,a6
move.l (sp)+,a1
jsr -222(a6) ;restore OS screen
*--- close lib+exit ---*
move.l a6,a1 ;close graphics library
move.l 4.w,a6
jsr -414(a6)
.quit:
moveq #0,d0 ;clear error return code to OS
rts ;back to AmigaDOS/Workbench.
.GetVBR:
dc.w $4e7a,$c801 ;hex for "movec VBR,a4"
rte ;return from Supervisor mode
.GfxLib:
dc.b "graphics.library",0,0
WaitEOF: ;wait for end of frame
bsr.s WaitBlitter
move.w #$138,d0
WaitRaster: ;Wait for scanline d0. Trashes d1.
.l: move.l 4(a6),d1
lsr.l #1,d1
lsr.w #7,d1
cmp.w d0,d1
bne.s .l ;wait until it matches (eq)
rts
AllOff:
move.w #$7fff,d2 ;clear all bits
move.w d2,$96(a6) ;in DMACON,
move.w d2,$9a(a6) ;INTENA,
IntReqD2:
move.w d2,$9c(a6) ;and INTREQ
move.w d2,$9c(a6) ;twice for A4000 compatibility
rts
WaitBlitter: ;wait until blitter is finished
tst.w (a6) ;for compatibility with A1000
.loop: btst #6,2(a6)
bne.s .loop
rts
endif

View File

@ -307,7 +307,7 @@ CheckPlayerMiss:
move.w playerMissPixels,d1
cmp.w spriteL,d1
beq .check
rts
jmp PostCheckPlayerMiss
.check:
cmp.w #1,pathwayMissPending
@ -414,7 +414,7 @@ CheckPlayerMiss:
.dontClearPathway:
jsr DetectItemCollisions
rts
jmp PostCheckPlayerMiss
GetNextAutoMove:

View File

@ -1,4 +1,6 @@
;; see - docs/Howtocode5.txt
if TRACKLOADER=0
IFND EXEC_EXEC_I
include "exec/exec.i"
ENDC
@ -6,49 +8,48 @@
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
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 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 CLI
movem.l (sp)+,d0/a0 ;restore regs
bra end_startup ;and run the user prog
* we were called from the Workbench
;; we were called from the Workbench
fromWorkbench:
lea pr_MsgPort(a4),a0
move.l 4.w,a6
jsr _LVOWaitPort(A6) wait for a message
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
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
;; do some other stuff here RSN like the command line etc
nop
movem.l (sp)+,d0/a0 restore
movem.l (sp)+,d0/a0 ;restore
end_startup:
bsr.s Entry call our program
bsr.s Entry ;call our program
* returns to here with exit code in d0
move.l d0,-(sp) save it
;; 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
beq.s exitToDOS ;if I was a CLI
move.l 4.w,a6
jsr _LVOForbid(a6)
@ -57,9 +58,9 @@ end_startup:
jsr _LVOReplyMsg(a6)
exitToDOS:
move.l (sp)+,d0 exit code
move.l (sp)+,d0 ;exit code
rts
* startup code variable
;; startup code variable
returnMsg: dc.l 0
endif

View File

@ -138,6 +138,7 @@ out/main.bin: out/main.o $(OBJS)
out/shrunk.bin: $(SHRINKLER_EXE) out/main.bin
$(SHRINKLEREXE) -d out/main.bin out/shrunk.bin
.PHONE: clean
clean:
rm -rf out bin *~