home *** CD-ROM | disk | FTP | other *** search
- ********************************************************************************
- * *
- * BootPic V2.1 *
- * (source-code) *
- * *
- * Author: Andreas Ackermann *
- * Assembler: Devpac V2.14D *
- * Date: from 8.7. to 19.7. 1991 to 29.12.1991 to 18.1.1992 15.7.'92 *
- * Develloped under Kickstart V1.2 *
- * *
- * [see doc-file for further information]. *
- * *
- * The whole programm is split in two parts: *
- * 1st we look what the user wants, then we remove or install BootPic in the *
- * way it is requested. *
- * The 2nd part, which is installed resident, is responsible for showing the *
- * picture. *
- * *
- * Added intuition-interface, main part unchanged, int-routines documented *
- * in intuition_support.asm *
- * *
- * NEW !!!: 18|12|91 BUG behoben: Resetfeste Teile ins CHIP-Mem !!! *
- * 29|12|91 :[finished] *
- * CRNG-Support *
- * Kick2.0 support ( bug removed [view] ) *
- * DPaint IV support ( no crash when more than 32 colors !!) *
- * Starting 14.1.: MED_Support *
- * 23.1.: pp-packed modules + playmodule nur dann resetfest, wenn modul*
- * geladen ist *
- * ??.5. -d Option *
- * 15.6.: 1MB Chip-RAM sollte mit Kick 1.3 keine Probleme machen !!! *
- * 19.6.: test, ob Version=ROM-Version *
- * 13.7.: anfang bootselektor + Bootsel fertig *
- * 14.7.: Nocklick *
- * 31.7. Noclick wieder entfernt ( ging nicht ) *
- * 10.8 coldcap wurde immer gelöscht; jetzt nur wenn er gesetzt war *
- ********************************************************************************
-
- ; This was my first programm I ever wrote in assembler ( at least a large
- ; part of it) . So some parts may confuse you , as they could be expressed
- ; much better. Please don't laugh ! But as everything seems to do its job
- ; I left everything as is. I'm sorry for not having the time to document
- ; the source. If you have any questions, propositions, if you ( god knows
- ; how) find a bug please write me. Please include postage for my answer.
- ; Maybe you wonder how the bootselector works:
- ; To reassemble the file you'll have to change the include paths for
- ; gfx, dos, arp and intuition in standard.macs to your needs
- ;
- ; _lvosetfunction manipulates ANY libraryfunction, so your code is called
- ; instead of the old function. Then it's your turn to call the original
- ; function.
- ; I change opendevice. Everytime opendevice is called, I check if it's
- ; trackdiskdevice. If yes, I change the unitnumber for my own needs
- ; ( if System wants df0: I simply pass df1: oder df2: !!!)
- ; look at label 'activatebootsel'
-
- rsreset
- border rs.l 0
- bd_leftedge rs.w 1
- bd_topedge rs.w 1
- bd_frontpen rs.b 1
- bd_backpen rs.b 1
- bd_drawmode rs.b 1
- bd_count rs.b 1
- bd_XY rs.l 1 ; ^ auf Daten
- bd_nextborder rs.l 1
- size_of_border rs.l 0
- rsreset
-
- gadget rs.l 0
- gd_nextgadget rs.l 1
- gd_leftedge rs.w 1
- gd_topedge rs.w 1
- gd_width rs.w 1
- gd_height rs.w 1
- gd_flags rs.w 1
- gd_activation rs.w 1
- gd_gadgettype rs.w 1
- gd_gadgetrender rs.l 1
- gd_selectrender rs.l 1
- gd_gadgettext rs.l 1
- gd_dummy rs.l 1
- gd_specialinfo rs.l 1
- gd_gadgetid rs.w 1
- gd_userdata rs.l 1
- size_of_gadget rs.l 0
- rsreset
-
- itext rs.l 0
- it_frontpen rs.b 1
- it_backpen rs.b 1
- it_drawmode rs.b 2 ; Dummy eingeschlossen !!!)
- it_leftedge rs.w 1
- it_topedge rs.w 1
- it_textattr rs.l 1
- it_itext rs.l 1
- it_nexttext rs.l 1
- size_of_itext rs.l 0
- rsreset
-
- gadget1 equ 0
- render1 equ 46
- koords equ render1+20
- itext1 equ koords+24
- itext2 equ itext1+24
-
- bufferstart equ 770
-
- gadgetmemsize equ 570+50+50+100+34+200 ; ???
-
-
- include "standard.macs"
- include "exec/exec_lib.i"
- include "bpic_special.i"
- include "dev_support.i"
-
- windowsup
-
- movem.l d0/a0,-(sp) ;save commandline parameters
- move.l playerstart-8,playerlength
- move.l 4.w,a6
- opendos
- opengfx
- openint ;arp erst später öffnen, da sonst Absturz
- sub.l a1,a1 ;wenn Start von WB und arp noch nicht geladen
- jsr _lvoFindTask(a6) ;find structure of our task
- move.l d0,a4
- move.l a4,taskptr
-
-
- movem.l (sp)+,d0/a0 ;return commandline parms
- tst.l pr_CLI(a4) ;WB?
- beq.s workbench !!!
- movem.l d0/a0,-(sp)
- getdos
- jsr _lvooutput(a6) ;get handle of CLI
- move.l d0,whandle
-
- lea welcome(pc),a2 ;introduce ourselves
- bsr stringout
- movem.l (sp)+,d0/a0
- bsr parser
- tst.b mparm
- beq.s cli_int
-
- bsr _bootpic ;call our programm
- fromparse
- bra _exit
- workbench
-
- move.l taskptr(pc),a4
- lea pr_MsgPort(a4),a0 ;if WB we must wait for startup-msg
- jsr _lvowaitport(a6)
- lea pr_MsgPort(a4),a0
- jsr _lvogetmsg(a6)
- move.l d0,wbenchmsg ;save message !!
- move.l d0,a0
- cmp.l #1,$1c(a0)
- beq.s cli_int
- move.l $24(a0),a0
- move.l 8(a0),d1 ;ob andere icons mit selektiert wurden
- move.l 12(a0),thename
- getdos
- jsr _lvocurrentdir(a6)
- move.l d0,thelock
- cli_int
- move.l 4.w,a6
- openarp
-
- bsr initwindow
- tst.l thename
- beq.s 1$
- move.l thename(pc),a0
-
- move.l gadgetmem(pc),a1
- move.l a1,a2
- add.l #bufferstart+100,a1
- add.l #bufferstart+50,a2
- 10$ move.b (a0),(a1)+
- move.b (a0)+,(a2)+
- bne.s 10$
-
- 1$ move.l userport(pc),a2
- bsr waitmsg
- cmp.l #$200,20(a1)
- beq 6$
- move.l 28(a1),a0
- move.w gd_gadgetid(a0),theid
- jsr _lvoreplymsg(a6)
- cmp.w #8,theid
- bne.s 2$
- bsr infowindow
- 2$ cmp.w #6,theid
- bne 3$
- lea.l reqtext(pc),a0
- bsr getfilename
- tst.b d0
- beq.s 1$
- move.l gadgetmem(pc),a0
- add.l #bufferstart+100,a0
- lea gdef(pc),a1
- 207$
- move.b (a0),(a1)+
- tst.b (a0)+
- bne.s 207$
- move.l gadgetmem(pc),a0
- add.l #bufferstart+100,a0
- clr.b (a0)
- move.l #gdef,fname
- getint
- move.l windowptr(pc),a0
- jsr _lvoviewportaddress(a6)
- getgfx
- move.l d0,a0
- move.l 4(a0),a0
- moveq #0,d0
- jsr _lvogetrgb4(a6)
- lea konst(pc),a0
-
- move.b d0,2(a0)
- and.b #%1111,2(a0)
- lsr.w #4,d0
- move.b d0,1(a0)
- and.b #%1111,1(a0)
- lsr.b #4,d0
- move.b d0,(a0)
- bsr yesnowindow
- tst.w d0
- beq.s 277$
- move.l gadgetmem(pc),a0
- add.l #bufferstart+50,a0
- clr.b (a0)
- lea.l qtext(pc),a0
- bsr getfilename
- tst.b d0
- beq.s 277$
- move.l gadgetmem(pc),a0
- add.l #bufferstart+100,a0
- move.l a0,modulename
-
-
- 277$
- bsr _bootpic
- 3$ cmp.w #7,theid
- bne.s 50$
- move.b #1,remptr
- bsr _bootpic
- bra 1$
- 50$ cmp.w #10,theid
- bne.s 51$
- tst.w kickflag
- beq.s 501$
- clr.w kickflag
- bra 1$
- 501$
- move.w #1,kickflag
- 51$ cmp.w #9,theid
- bne.s 4$
- tst.w cycflag
- beq.s 511$
- clr.w cycflag
- bra 1$
- 511$
- move.w #1,cycflag
-
-
- 4$ bra 1$
- 6$ jsr _lvoreplymsg(a6)
- bsr windowcleanup
- getdos
- move.l thelock(pc),d1
- beq.s nolock
- jsr _lvocurrentdir(a6)
- nolock
- tst.l wbenchmsg ;run from WB ?
- beq.s _exit ;no => CLI
-
- move.l 4.w,a6
- jsr _lvoforbid(a6)
- move.l wbenchmsg(pc),a1 ;return message
- jsr _lvoreplymsg(a6)
-
- _exit
- move.l 4.w,a6
- closedos
- closegfx
- closeint
- move.l arpbase(pc),d0
- beq.s noarp
- closearp
- noarp clr.l d0 ;no returncode
- rts ;the end
-
- arpstuff
-
- taskptr dc.l 0
- thename dc.l 0
- thelock dc.l 0
- theid dc.w 0
-
-
- * a2= portaddresse erg:message=a1
- waitmsg
- move.l 4.w,a6
- move.l a2,a0
- jsr _lvowaitport(a6)
- move.l a2,a0
- jsr _lvogetmsg(a6)
- move.l d0,a1
- rts
-
-
-
- parser ;here we get from CLI : figure out
- ;what the user wants
- subq.w #1,d0 ;any parms ? no->int-window
- beq wrt2 ;noparms
- clr.w kickflag ;bei cli ist das keine Voreinstellung !!!(BootSel)
- clr.b 0(a0,d0.w) ;zero-terminate it
- plop bsr getspcout
- cmp.b #'-',(a0)+
- bne noparms ;no '-' in front of parameter
- bclr.b #5,(a0) ;force uppercase
- cmp.b #'R',(a0) ;get out -r
- bne.s noreset
- move.b #1,resetvar
- addq.l #1,a0
- bra.s plop ; -k
- noreset cmp.b #'K',(a0)
- bne.s nokick
- addq.l #1,a0
- move.w #1,kickflag
- bra.s plop
- nokick cmp.b #'Y',(a0) ; colorcycling
- bne.s nocyc
- move.w #1,cycflag
- addq.l #1,a0
- bra.s plop
- nocyc cmp.b #'E',(a0) ;get out -e
- bne.s noremove
- move.b #1,mparm
- move.b #1,remptr
- addq.l #1,a0
- bra.s plop
- noremove
- cmp.b #'S',(a0) ;get out -s
- bne.s nostartup
- move.b #1,startup
- addq.l #1,a0
- bra.s plop
- nostartup
- cmp.b #'D',(a0) ;get out -s
- bne.s nodelay
- addq.l #1,a0
- bsr getspcout
- moveq #0,d0
- move.b (a0)+,d0
- sub.w #$30,d0
- mulu #50,d0
- move.w d0,delaytime
- bra plop
-
- nodelay
- cmp.b #'L',(a0) ;get out -l
- bne.s noload
- move.b #1,mparm
- addq.l #1,a0
- bsr getspcout
- move.l a0,fname
- findspc addq.l #1,a0
- cmp.b #' ',(a0)
- beq.s terminate1
- tst.b (a0)
- bne.s findspc
- beq plop
- terminate1
- clr.b (a0)+
- bra plop
- noload
- cmp.b #'M',(a0) ;get out -m
- bne.s nomed
- addq.l #1,a0
- bsr getspcout
- move.l a0,modulename
- findspc5 addq.l #1,a0
- cmp.b #' ',(a0)
- beq.s terminate15
- tst.b (a0)
- bne.s findspc5
- beq plop
- terminate15
- clr.b (a0)+
- bra plop
-
-
- nomed cmp.b #'C',(a0)+ ;get out -c
- bne.s noparms ;someone typed nosense after '-'
- bsr getspcout
- moveq.w #2,d0
- lea konst(pc),a1 ;there we put the color
- cl tst.b (a0)
- beq.s wrt3 ;ende
- cmp.b #' ',(a0)
- beq.s wrt3 ; ende
- sub.b #48,(a0)
- cmp.b #10,(a0)
- blt.s no15
- bclr.b #5,(a0)
- sub.b #7,(a0)
- no15 and.b #%1111,(a0)
- move.b (a0)+,(a1)+
- dbf d0,cl
- bra plop
-
- getspcout
- tst.b (a0) ;increase a0 till we find a space or zero
- beq.s wrt
- cmp.b #' ',(a0)+
- beq.s getspcout
- subq.l #1,a0
- rts
- wrt addq.l #4,sp
- wrt3 rts
- wrt2 clr.b mparm
- rts
- noparms add.l #4,a7
- lea use(pc),a2
- bsr stringout
- bra fromparse
-
-
- _bootpic
- movem.l d0-1/d3-7/a0-1/a3-6,-(sp)
- lea crngs(pc),a0
- move.w #(7*2)-1,d0
- 100$ clr.l (a0)+
- dbf d0,100$
- ; clr.w kickflag
- move.l 4.w,a6 ;the parms were correct, so let's kill a possibly
- move.l 546(a6),a3 ;installed BootPic at any rate
- tst.l 546(a6)
- beq notinstalled
- chknxt move.l LN_NAME(a3),a0
- cmp.l #'BPic',(a0) ;go through memlist till we find BootPic
- beq.s bpicfound ;or till the end
- tst.l (a3) ;[tst.l LN_SUCC(a3)]
- beq notinstalled
- move.l (a3),a3 ;[move.l LN_SUCC(a3),a3] next node
- bra.s chknxt
- bpicfound ;we found BootPic !!!
- tst.b startup ;check for -s flag: if not set let's remove BootPic
- beq.s remove
- lea stext(pc),a2 ;tell the user that BPic is installed
- bra noopen ;return
- remove jsr _lvoforbid(a6) ;in a3 we still hold the memlist-node of BPic
- tst.l LN_PRED(a3) ;is there anyone before ?
- beq.s nopred ;if not, we're first
- move.l LN_PRED(a3),a0 ;move our successor(or zero) to the successor
- move.l (a3),(a0) ;of our predecessor
- tstsuc tst.l (a3) ;is there any successor ?
- beq.s predok ;no, everything ok
- move.l (a3),a1 ;if so we must move its address to the
- move.l a0,LN_PRED(a1) ;successor's address of our predecessor
- bra.s predok
- nopred move.l (a3),546(a6) ;if we're first, we must write the start of
- sub.l a0,a0 ;memlist into sysbase->kickmemptr
- bra.s tstsuc
- predok ;we switched off multitasking, so we can free
-
- move.w LN_NAME+4(a3),d3;the allocated memory already now (numentries)
- subq.w #1,d3 ;LN_NAME+4 = ML_NUMENTRIES
- add.l #LN_NAME+6,a3 ;start of memorypointer table
- tst.l playerstart-8
- bne.s fagain ; wegen remove wenn noch kein reset war
- clr.l 24-8(a3)
- clr.l 28-8(a3)
- move.l playerlength(pc),playerstart-8
-
- fagain move.l (a3)+,a1 ;startaddress
- move.l (a3)+,d0 ;length
- jsr _lvofreemem(a6) ;free it
- dbf d3,fagain ;usually twice (dbf loop for reasons of compa-
- ;tibilty to higher versions that might follow)
- move.l 550(a6),a3 ;kicktagptr to a3
- nentry move.l (a3),a0
- move.l rt_name(a0),a0
- cmp.l #'BPic',(a0) ;check first resident structure for BPic
- beq.s bpicf2
- move.l a3,a4 ;save actual restabptr
- add.l #4,a3 ;next entry
- move.l (a3),d0 ;no more entrys ?! but we found BPic's memory and now
- beq.s finito ;we found not its resident structure => fatal error !
- btst.l #$1f,d0 ;next entry or pointer to next restab
- beq.s nentry
- bclr.l #$1f,d0 ;clear highbit
- move.l d0,a3 ;lets' check next residenttable structure
- bra.s nentry
-
- finito lea.l fail(pc),a2 ;if we run here there was a fatal error
- jsr _lvopermit(a6)
- bra noopen
-
- bpicf2 cmp.l 550(a6),a3 ;is our actual restab the same as in kicktagptr?
- bne.s linkout ;if not we have a predecessor (held in a4)
- move.l 4(a3),d0 ;move our sucessor (or zero) to kicktagptr
- bclr.l #$1f,d0 ;clear highbit
- move.l d0,550(a6)
- bra.s ready
- linkout move.l 4(a3),4(a4) ;put our successor (or zero) to our predecessor
- ready
- jsr -612(a6) ;calc checksum (kicksumdata)
- move.l d0,554(a6)
-
- move.l $2a(a6),d0
- beq.s 56$
- move.l d0,a0
- cmp.l #'Acki',-4(a0)
- bne.s 56$
- clr.l $2a(a6)
- 56$ moveq.l #0,d0
- lea 34(a6),a0
- move.w #22,d1
- chkloop2
- add.w (a0)+,d0
- dbf d1,chkloop2
- not.w d0
- move.w d0,82(a6)
-
-
-
- jsr _lvopermit(a6)
- lea remt(pc),a2 ;print out that we removed it
- bsr stringout
- sub.l a2,a2
- tst.b remptr ;check for -e: was that all we should do?
- bne noopen ;yes->return, no-> let's try to load the picture
- notinstalled
- lea nrem(pc),a2
- tst.b remptr ;test if user typed -e;but BPic was not there
- bne noopen ;return and let's tell him if so
-
-
- move.l dosbase(pc),a6
- move.l fname(pc),d1
- move.l #1005,d2
- jsr _lvoopen(a6) ;try to open file
- lea fnf(pc),a2
- move.l d0,handle
- beq noopen ;if error let's tell the user
-
- move.l 4.w,a6
- move.l #4000,d0
- move.l #$10003,d1 ;chip+clear
- jsr _lvoallocmem(a6);get memory for readbuffer of file
- lea nomem(pc),a2
- move.l d0,buffer
- beq nobufmem
- move.l #allmeml,d0
- move.l #$10003,d1 ;memf_public+clear+ CHIP !!!! 18|12|91
- jsr _lvoallocmem(a6);get memory for our special structure
- move.l d0,a5 ;from now on this pointer is to be found in a5
- beq nostruktmem
-
- move.l dosbase(pc),a6
- move.l handle(pc),d1
- move.l buffer(pc),d2
- moveq.l #12,d3
- jsr _lvoread(a6) ;read header of file
- move.l buffer(pc),a4 ;buffer to address-register so that we can use
- lea nilbm(pc),a2 ;offsets
- cmp.l #'FORM',(a4)
- bne noiff ;no IFF->error
- cmp.l #'ILBM',8(a4)
- bne noiff ;not ILBM->error
- getchunk
- move.l handle(pc),d1
- moveq.l #8,d3
- jsr _lvoread(a6) ;read header of chunk
- lea bnf(pc),a2 ;4 Bytes code word + 4 Bytes length
- tst.l d0 ;end of file ? but we didn't find BODY
- beq noiff ;->error
- cmp.l #'BODY',(a4)
- beq bodyfound
- cmp.l #'CMAP',(a4)
- beq cmapfound
- cmp.l #'CAMG',(a4)
- beq camgfound
- cmp.l #'CRNG',(a4)
- beq crngfound
- cmp.l #'BMHD',(a4)
- beq bmhdfound
- bsr rcdata ;if we get here it wasn't any chunk we need
- bra.s getchunk
- bodyfound
-
- move.l 4.w,a6
- move.l 4(a4),d0
- addq.l #7,d0
- addq.l #3,d0
- move.l d0,ml_len2(a5)
- addq.l #7,d0 ;allocmem rounds down by 8 bytes ;vorher 8
- move.l #$10003,d1
- jsr _lvoallocmem(a6);memory for BODY-chunk
- lea nmfb(pc),a2
- move.l d0,memptr
- beq noiff
- move.l d0,d2
- move.l dosbase(pc),a6
- bsr rcdata ;read BODY in
- move.l 4.w,a6
- nofast move.l memptr(pc),a3
- memfreed
- move.l a3,ml_addr2(a5)
- tst.b camgf ;did we find CAMG ?
- bne.s noham
- lea ncamg(pc),a2 ;let's tell the user that we improvise
- bsr stringout
- sub.l a2,a2
- cmp.w #353,vp_dwidth(a5) ;wider than 352 bytes?
- blt.s nohires ;it must be hires
- add.w #$8000,vp_modes(a5)
- nohires
- cmp.w #283,vp_dheight(a5) ;...
- blt.s nolace
- add.w #$4,vp_modes(a5)
- nolace
- cmp.w #6,depth(a5) ;HAM and Halfbright work with 6 planes
- bne.s noham
- add.w #$800,vp_modes(a5) ;I say it's HAM !!!
- noham
- move.l a5,strktptr ;put the pointer to our structure into the
- lea suc(pc),a2 ;resident code (will be copied later on! )
- move.l gfxbase(pc),a6
- lea view(a5),a1 ;init all we need to show the picture
- jsr _lvoinitview(a6)
- ; wichtig: um später verändern zu können : für neue modi !!!
- nop
- and.w #$ffff,vp_modes(a5)
- nop
-
- move.w vp_modes(a5),v_modes(a5)
- elea viewport(a5),v_viewport(a5)
- lea bitmap(a5),a0
- move.w depth(a5),d0
- move.w bmw(a5),d1
- move.w bmh(a5),d2
- jsr _lvoinitbitmap(a6)
- lea.l rasinfo(a5),a0
- elea bitmap(a5),ri_bitmap(a5)
- elea rasinfo(a5),vp_rasinfo(a5)
- move.w vp_modes(a5),d0 ;if overscan move the picture to top left
- move.w #320,d1 ;corner
- btst.l #$f,d0
- beq.s nohires2
- lsl.w #1,d1
- nohires2
- neg.w d1
- add.w vp_dwidth(a5),d1
- bpl.s doit1
- clr.w d1
- doit1 lsr.w #1,d1
- sub.w d1,v_dxoffset(a5)
- move.w #256,d1
- btst.l #$2,d0
- beq.s nolace2
- lsl.w #1,d1
- nolace2 neg.w d1
- add.w vp_dheight(a5),d1
- bpl.s doit
- clr.w d1
- doit lsr.w #1,d1
- sub.w d1,v_dyoffset(a5)
-
-
- move.l modulename(pc),a0
- move.l a0,d0
- beq.s 1$
- bsr _loadmodule
- tst.l d0
- beq.s 11$
- move.l d7,modlength
- move.l d0,modulestart
-
-
- move.l playerlength(pc),ml_len3(a5)
- sub.l #10,ml_len3(a5)
- clr.l playerstart-8
- move.l #playerstart,ml_addr3(a5)
-
-
-
- move.l modulestart(pc),ml_addr4(a5)
- move.l modlength(pc),ml_len4(a5)
- bra.s 2$
- 11$ lea nomod(pc),a2
- bsr stringout
- sub.l a2,a2
- 1$ clr.l modlength
- 2$ lea idendity(a5),a0 ;copy code into allocated memory
- lea begincopy(pc),a1
- move.w #endcopy-begincopy-1,d0
- idlop move.b (a1)+,(a0)+
- dbf d0,idlop
- clr.l modulename
- clr.l modlength
- clr.l modulestart
- clr.w packflag
- move.l a5,ml_addr1(a5) ;intialize resident structure
- move.l #allmeml-20,ml_len1(a5) ; vorher 20
- fillout move.w #rtc_matchword,rt_matchword(a5)
- elea rt_matchword(a5),rt_matchtag(a5)
- elea rt_SIZE(a5),rt_endskip(a5)
- move.b #1,rt_flags(a5)
- move.b #-1,rt_pri(a5)
- elea id_name(a5),rt_name(a5)
- elea id_string(a5),rt_idstring(a5)
- elea code(a5),rt_init(a5)
-
- move.w #2,ml_numentries(a5) ;init memlist structure
- tst.l ml_addr4(a5)
- beq.s 1$
- add.w #2,ml_numentries(a5)
- 1$ elea id_name(a5),myln_name(a5)
- move.b #nt_memory,myln_type(a5)
-
- login
- getexe
- cmp.w #34,$14(a6) ; Test auf Kick 1.3
- bne.s wert5
- move.l $3e(a6),d0
- cmp.l #$80000,d0
- bhi.s 2$
-
- bra.s wert5
- 2$
- lea coldcapoff(a5),a0
- move.l a0,$2a(a6) ; coldcapvector
-
- moveq.l #0,d0
- lea 34(a6),a0
- move.w #22,d1
- chkloop1
- add.w (a0)+,d0
- dbf d1,chkloop1
- not.w d0
- move.w d0,82(a6)
-
- wert5
- jsr _lvoforbid(a6) ;let's write ourselves into sysbase
- move.l 546(a6),a1 ;kickmemptr
- tst.l 546(a6)
- beq.s nixda ;we always use first place and put
- move.l a1,myln_succ(a5) ;any things that were before us behind us
- elea myln_succ(a5),4(a1) ;[predecessor]
-
- nixda elea myln_succ(a5),546(a6) ;and now for kicktagptr
- move.l a5,restab(a5)
- move.l 550(a6),d0
- beq.s nomtag
- bset #$1f,d0
- move.l d0,restab+4(a5)
-
- nomtag elea restab(a5),550(a6)
- jsr -612(a6) ;kicksumdata
- move.l d0,554(a6) ;fill in kickchecksum
- jsr _lvopermit(a6)
-
- tst.b resetvar ;does the user want to reset the machine?
- beq.s nostruktmem
- lea cod(pc),a5
- lea 2,a4
- jsr _lvosupervisor(a6) ;that's all ...
- cnop 0,4
- cod reset
- jmp (a4)
- noiff ;here we run if there's an error while
- move.l 4.w,a6 ;loading
- move.l a5,a1
- move.l #allmeml,d0
- jsr _lvofreemem(a6)
- nostruktmem ;not enough memory for our structure
- move.l 4.w,a6
- move.l buffer(pc),a1
- move.l #4000,d0
- jsr _lvofreemem(a6)
- nobufmem ;not enough mem for diskbuffer
- move.l dosbase(pc),a6
- move.l handle(pc),d1
- jsr _lvoclose(a6)
- noopen ;move.l dosbase(pc),a6
- move.l a2,d2
- beq.s noerr
- bsr stringout
- noerr clr.l remptr
- clr.b camgf
- move.b #1,mparm
- movem.l (sp)+,d0-1/d3-7/a0-1/a3-6
- rts
- ;!!!2.0!!!
- modulename dc.l 0
-
- ; Function: d0 = _LoadModule(a0)
- ; a0 = module name
- ; d0 = pointer to loaded module, zero if load failed
-
- ; xdef _LoadModule
- ; xdef _UnLoadModule
- ; code
- ; d7= länge !!!!!!!
-
- _LoadModule:
- movem.l a2-a4/a6/d2-d6,-(sp)
- moveq #0,d6 ;d6 = return value (zero = error)
- move.l a0,a4 ;a4 = module name
- movea.l 4,a6
- lea dosname(pc),a1
- jsr -$198(a6) ;OldOpenLibrary()
- tst.l d0
- beq xlm1
- move.l d0,a3 ;a3 = DOSBase
- move.l d0,a6
- move.l a4,d1 ;name = d1
- move.l #1005,d2 ;accessmode = MODE_OLDFILE
- jsr -$1e(a6) ;Open()
- move.l d0,d4 ;d4 = file handle
- beq xlm2
- move.l d4,d1
- moveq #0,d2
- moveq #1,d3 ;OFFSET_END
- jsr -$42(a6) ;Seek(fh,0,OFFSET_END)
- move.l d4,d1
- moveq #0,d3
- not.l d3 ;OFFSET_BEGINNING
- jsr -$42(a6) ;Seek(fh,0,OFFSET_BEGINNING)
- move.l d0,d5 ;d5 = file size
- move.l d0,d7
- movea.l 4,a6
- moveq #2,d1 ;get chip mem
- jsr -$c6(a6) ;AllocMem()
- tst.l d0
- beq.s xlm3
- move.l d0,a2 ;a2 = pointer to module
- move.l d4,d1 ;file
- move.l d0,d2 ;buffer
- move.l d5,d3 ;length
- move.l a3,a6
- jsr -$2a(a6) ;Read()
- cmp.l d5,d0
- bne.s xlm4 ;something wrong...
-
- cmp.l #'PP11',(a2)
- beq.s lm_packed
- cmp.l #'PP20',(a2)
- beq.s lm_packed
- cmp.l #'MMD0',(a2)
- bne.s xlm4 ;this is not a module!!!
-
- movea.l a2,a0
- ;opt o-
- jsr _RelocModule
- ;opt o+
- move.l a2,d6 ;no error...
- bra.s xlm3
- xlm4: move.l a2,a1 ;error: free the memory
- move.l d5,d0
- movea.l 4,a6
- jsr -$d2(a6) ;FreeMem()
- xlm3: move.l a3,a6 ;close the file
- move.l d4,d1
- jsr -$24(a6) ;Close(fhandle)
- xlm2: move.l a3,a1 ;close dos.library
- movea.l 4,a6
- jsr -$19e(a6)
- xlm1: move.l d6,d0 ;push return value
- movem.l (sp)+,a2-a4/a6/d2-d6 ;restore registers
- rts ;and exit...
-
- lm_packed
- move.w #1,packflag
- move.l a2,d6
- bra.s xlm3
-
-
- **//** SUBs + chunk-reading routines
-
- * print out a zero-termintated string of which the start is found in a2
- stringout
- move.l a6,-(a7)
- tst.l rastport
- beq.s 1$
- getgfx
- moveq.w #1,d0
- move.l rastport(pc),a1
- jsr _lvosetapen(a6)
- move.l rastport(pc),a1
- moveq.w #67,d0
- move.w #144,d1
- move.w #445,d2
- move.w #160,d3
- jsr _lvorectfill(a6)
-
-
- move.w #72,d2
- move.w #154,d3
- move.l a2,a0
- 6$ tst.b (a0)+
- bne.s 6$
- cmp.b #10,-2(a0)
- bne.s 5$
- clr.b -2(a0)
- 5$ bsr schatten
- bra sende
- 1$
-
- move.l a2,d2
- move.l #-1,d3
- p1 addq.l #1,d3
- tst.b (a2)+
- bne.s p1
- move.l whandle(pc),d1
- move.l dosbase(pc),a6
- jsr _lvowrite(a6)
- sende
- move.l (sp)+,a6
- rts
-
- * read in one chunk
- rcdata
- move.l 4(a4),d3
- move.l handle,d1
- jsr _lvoread(a6)
- rts
-
- * get colormap [format see at getcols ! ]
- cmapfound
- move.l 4(a4),d4
- cmp.l #100,d4
- blt.s 1$
- move.l #3*32,d4
- 1$ move.l buffer(pc),d2
- ; elea coltab(a5),d2
- bsr rcdata
- ; move.l buffer(pc),d2
- move.l d2,a1
- lea coltab(a5),a0
- gcol move.b (a1)+,d0
- lsr.b #4,d0
- and.b #%1111,d0
- move.b d0,(a0)+
- dbf d4,gcol
- bra getchunk
-
- crngfound
- bsr rcdata
- btst #0,5(a4)
- beq.s 2$
- tst.w 2(a4)
- beq.s 2$
- lea crngs(pc),a0
- subq.l #8,a0
- moveq.l #0,d0
- 1$ addq.l #8,a0
- addq.l #1,d0
- cmp.b #7,d0
- beq.s 2$
- tst.b crng_flag(a0)
- bne.s 1$
- move.w 4(a4),crng_flag(a0)
- move.b #$ff,crng_flag(a0)
- move.w 6(a4),crng_start(a0)
-
- moveq.l #0,d0
- move.w #$ffff,d0
- divu.w 2(a4),d0
- and.l #$ffff,d0
- divu.w #5,d0
- addq.w #1,d0
- move.w d0,crng_ticks(a0)
- swap d0
- cmp.w #2,d0
- bls.s 2$
- add.w #1,crng_ticks(a0)
- 2$ bra getchunk
- * here are the viewmodes
- camgfound
-
- bsr rcdata
- move.w modes+2(a4),vp_modes(a5) ;get the viewmodes
- move.b #1,camgf
- bra getchunk
- * get the dimensions of the picture
- bmhdfound
- bsr rcdata
- move.l w(a4),bmw(a5) ;w+h are .w so .l is enough for both
- move.b nplanes(a4),depth+1(a5)
- move.b masking(a4),mask(a5)
- lea ncomp(pc),a2
- tst.b compression(a4);we won't load compressed pictures
- beq noiff
- move.w bmw(a5),vp_dwidth(a5)
- move.w bmh(a5),vp_dheight(a5)
- bra getchunk
- **//**
-
- wbenchmsg dc.l 0 ;contains msg if run from WB
- ;conbuf dc.l 0 ;readbuffer for CON:-window
- remptr dc.b 0 ;set if -e was specified
- resetvar dc.b 0 ;set if -r was specified
- mparm dc.b 0 ;set if either -e or -l was specified
- startup dc.b 0 ;set if -s was specified
- camgf dc.b 0 ;set if CAMG was found
- dc.b 0 ;make even
- memptr dc.l 0 ;ptr to BODY-chunk
- buffer dc.l 0 ;ptr to readbuffer
- handle dc.l 0 ;handle of IFF-file
- dosbase dc.l 0 ;...
- whandle dc.l 0 ;handle we write to (CLI or CON:)
- fname dc.l 0 ;pointer to filename
- playerlength dc.l 0
- dosname dc.b 'dos.library',0
- even
- intstuff
- welcome dc.b 10,27,'[1;32m',' BootPic V2.1b ',27,'[0;31m','©1992 by '
- dc.b 27,'[3;33m','Andreas Ackermann',27,'[0;31m',10
- dc.b ' This programm is SHAREWARE. If you use it, please send '
- dc.b 27,'[1;32m','5$ or 5DM',27,'[0;31m to:',10
- dc.b ' Andreas Ackermann',10
- dc.b ' Lorenz-Summa-Str. 10',10
- dc.b ' W-8679 Oberkotzau',10
- dc.b ' GERMANY',10
- dc.b ' See Doc-File for detailed information !',10,10,0
- even
- nomod dc.b "Couldn't open Module / Not a MED-Module.",0
- even
- nmfb dc.b 'Not enough Memory for BODY-Chunk.',10,0
- even
- bnf dc.b 'BODY-Chunk not found.',10,0
- even
- ncamg dc.b 'Warning:CAMG-Chunk not found.',10,0
- even
- nilbm dc.b "It's not an ILBM-File Didn't load music either.",10,0
- even
- nomem dc.b "Couldn't get enough Memory.",10,0
- even
- fnf dc.b "Couldn't open Picturefile.",10,0
- even
- use dc.b "Usage: BootPic -e | -l{ILBM-filename} [-c rgb][-r][-s][-y][-k]",10
- dc.b " [-m {MED-Module}][-d time]",10
- dc.b "Without parms: An Intuition-style window will open.",10,0
- even
- remt dc.b "Removed old BootPicture (& MED-Mod.) from list.",10,0
- even
- ncomp dc.b 'Picture is not compressed. Save it with DPaint and try again.',10,0
- even
- suc dc.b 'BootPic successfully installed. Have fun !',10,0
- even
- fail dc.b 'Memlist Corrupt. Something went totally wrong !',10,0
- even
- stext dc.b 'BootPic already installed. Changed nothing.',10,0
- even
- nrem dc.b "BootPic was not installed. Couldn't remove it.",10,0
- even
-
- * Part of Programm that shows picture after reset
-
- begincopy
-
- idname dc.b 'BPic',0,0
- idstring dc.b 'BootPic,©1991 by Acki',0
- dc.b 0,0,0,0,0,0,0,0
-
- movem.l d0-7/a0-6,-(sp)
- lea delaycurrent(pc),a0
- clr.w (a0)
- move.l 4.w,a6
-
- move.l strktptr(pc),a5 ;get ptr of our special structure
- move.l ml_addr2(a5),a3 ;get ptr of BODY-data
- lea gfxname(pc),a1
- jsr _lvooldopenlibrary(a6)
- emove d0,gfxbase(pc)
-
- tdd_len equ 200
-
- moveq.l #0,d7
- lea iorequests(pc),a2
- open_device
- move.l #tdd_len,d0
- move.l d7,d2
-
- moveq.l #0,d1
- lea trddevice(pc),a0
- bsr open_a_device
- tst.l d0
- beq.s device_error
- addq.l #1,d7
- move.l d0,(a2)+
- lea kickflag(pc),a0
- tst.w (a0)
- beq.s device_error
- cmp.l #4,d7
- bne.s open_device
-
-
- device_error
- tst.l d7
- beq device_fail
-
- m_alloc #chip+clear+public,#1040
- emove d0,readbuf(pc)
- moveq.l #0,d5 ; wichtig !!! darf nicht veändert werden
- moveq.b #0,d2
- bsr readboot ;check for bootable disk in df0:
- tst.b d3 ;[see at readboot what d2 means !]
- beq cleanup
-
- move.l modulestart(pc),d0
- beq.s showpic
- ;opt o-
- jsr _initplayer
- ;opt o+
- lea packflag(pc),a0
- tst.w (a0)
- bne.s showpic
- move.l modulestart(pc),a0
- jsr _playmodule
- showpic move.l gfxbase(pc),a6 ;clear all pointers to copperlists
- clr.l view+4(a5) ;so that mrgcop knows that it has to take
- clr.l view+8(a5) ;new copperlists !
- moveq.w #4,d0
- lea vp_colormap(a5),a0
- cll clr.l (a0)+
- dbf d0,cll
-
- move.w depth(a5),d2 ;allocate planes; if masking then alloc one
- lea bm_planes(a5),a2 ;more plane that isn't to be found in
- cmp.b #1,mask(a5) ;bm_depth
- bne.s nomsk ; vorher beq.s
- subq.w #1,d2
- nomsk move.w bmw(a5),d0
- move.w bmh(a5),d1
- jsr _lvoallocraster(a6)
- move.l d0,(a2)+
- beq rasterfail
- dbf d2,nomsk
- clr.l (a2) ;zero-terminate bm_planes cause we'll free
- bsr unpackbody ;memory till we find zero
-
- move.l #32,d0 ;32 is always enough
- jsr _lvogetcolormap(a6)
- move.l d0,vp_colormap(a5)
- move.l d0,a0
-
- lea view(a5),a0
- lea viewport(a5),a1
- jsr _lvomakevport(a6)
- lea view(a5),a1
- jsr _lvomrgcop(a6) ;generate display
- move.l 34(a6),d7
-
- lea view(a5),a1
- jsr _lvoloadview(a6) ;let's show it
-
- lea coltab(a5),a2
- lea viewport(a5),a3
- lea white(pc),a4
- moveq.w #0,d0
- bsr fadein ;fade picture in
-
- lea packflag(pc),a0
- tst.w (a0)
- beq.s 14$
- move.l modulestart(pc),a0
- move.l modlength(pc),d0
- jsr _med_startup
- 14$
-
-
-
- lea vv_viewport(pc),a0
- lea viewport(a5),a1
- move.l a1,(a0)
- bsr getpalette
-
- move.l 4.w,a6
- move.b #1,d2
- bsr readboot ;wait for bootable disk
-
- ; a1 enthält noch die aktuelle iorequest
-
- bsr freepalette
- move.l gfxbase(pc),a6
- lea konst(pc),a4
- moveq.w #0,d0
- bsr fadeout ;fade to color specified under -c
-
-
- move.l modulestart(pc),d0
- beq.s 110$
- jsr _stopplayer
- jsr _remplayer
- jsr _med_cleanup
- 110$
- bclr #1,$bfe001
- move.l vp_colormap(a5),a0 ;free copperlists
- jsr _lvofreecolormap(a6)
- lea.l viewport(a5),a0
- jsr _lvofreevportcoplists(a6)
- move.l view+4(a5),a0
- jsr _lvofreecprlist(a6)
- move.l view+8(a5),a0
- jsr _lvofreecprlist(a6)
-
- clr.l 34(a6)
- rasterfail
- lea bm_planes(a5),a2
- nomsk2 move.l (a2)+,a0
- tst.l -4(a2)
- beq.s meme
- move.w bmw(a5),d0
- move.w bmh(a5),d1
- jsr _lvofreeraster(a6)
- bra.s nomsk2 ;free planes till we find zero
- meme
-
- cleanup move.l 4.w,a6 ;clean up everything we needed to wait for
- lea iorequests(pc),a2
- close_devs
- move.l (a2),d0
- beq.s no_more_devs
- move.l d0,a1
- clr.l (a2)+
- move.l #tdd_len,d0
- bsr close_a_device
- bra.s close_devs
-
- no_more_devs
- m_free readbuf(pc),#1040
-
- device_fail
- getexe
- move.l gfxbase(pc),a1
- jsr _lvocloselibrary(a6)
-
- movem.l (sp)+,d0-7/a0-6
- rts
-
- activatebootsel
- lea kickflag(pc),a0 ; check only df0: ?
- tst.w (a0)
- beq.s 570$
-
- cmp.w #35,20(a6) ; welche Kickstart, bitteschön ?
- bhi.s 570$ ; scho 2.0 ?! Dann braung' ma kan 'Buutselekta' !!
- moveq.l #$ff,d2 ; für nicht-franken: brauchen wir keinen Bootselektor
- lea iorequests(pc),a0
- 560$ addq.l #1,d2
- cmp.l (a0)+,a1
- bne.s 560$ ; how many drives are there ?
- tst.w d2
- beq.s 570$ ; only 1: nobootselector
-
- lea drvnum(pc),a0
- move.w d2,(a0)
- move.l 4.w,a6
- move.l #bs_end-bs_start+10,d0
- move.l #PUBLIC+CLEAR,d1
- jsr _lvoallocmem(a6)
- move.l d0,a1
- move.l d0,a2
- lea func(pc),a0
- move.w #bs_end-bs_start,d1
- 40$ move.b (a0)+,(a1)+
- dbf d1,40$
- move.l 4.w,a1
- move.l #_lvoopendevice,a0
- call setfunction
- move.l d0,vec-func+2(a2)
- 570$ rts
-
- bs_start
- func movem.l a0/a1,-(sp)
- lea trddevice(pc),a1
- 10$ tst.b (a1)
- beq.s doit5
- cmpm.b (a0)+,(a1)+
- beq.s 10$
- endit
- movem.l (sp)+,a0/a1
- vec jmp $0
-
- doit5
- lea drvnum(pc),a0
- tst.w d0
- beq.s 30$
- cmp.w (a0),d0
- bne.s 31$
- moveq.l #0,d0
- bra.s 31$
- 30$ move.w (a0),d0
- 31$ bra.s endit
-
-
- drvnum dc.w 0
- trddevice dc.b 'trackdisk.device',0
- even
- ; Wichtig: muß hier stehen, da dieser Bereich kopiert wird !!!
- bs_end
- * This routines checks for a bootable disk in df0: .
- * Result in d3.b : zero if a disk is there, 1 if no bootable disk in drive.
- * Flags: if d2.b=1 it will wait until a bootable disk is inserted
-
- * d0=länge des Speicherblocks *
- * d1=devicflags *
- * d2=deviceunit *
- * a0=devicenmae *
- * d0=0 => error else d0=pointer to iorequest *
-
- * a1=iorequest *
- * d0=länge des Speicherblocks *
- rmbcnt dc.w 0
- readboot
- getexe
- next_lw_loop
-
- lea iorequests(pc),a2
- moveq.l #$ff,d6
- next_lw
- lea rmbcnt(pc),a0
- btst.b #10,$dff016
- bne.s 20$
- tst.w (a0)
- bne.s 21$
- move.w #1,(a0)
- bchg #1,$bfe001
- bra.s 21$
- 20$ clr.w (a0)
- 21$
-
- addq.l #1,d6
- move.l (a2)+,d0
- beq leave_no_lw
- move.l d0,a1
- move.w #$e,io_command(a1)
- jsr _lvodoio(a6) ;check for disk in df0:
- tst.l 32(a1) ; 0 wenn disk da
- beq.s 1$
- bclr d6,d5 ; keine disk-> also auch kiene unbootfähige
- bra.s next_lw
- 1$ btst d6,d5 ; unbootfähig ? next_lw
- bne.s next_lw
- bsr test_boot
- tst.l d0
- beq.s leave_ok
- bset d6,d5
- bra.s next_lw
-
- leave_no_lw
- tst.b d2
- beq.s leave_error
- btst #6,$bfe001
- beq.s leave_ok_nodisk
- movem.l a0-1/d0-1,-(sp)
- getgfx
- call waittof
- lea delaycurrent(pc),a0
- add.w #1,(a0)
- move.w delaytime(pc),d0
- getexe
- cmp.w (a0),d0
- beq.s leave_okdelay
-
- movem.l (sp)+,a0-1/d0-1
- bra next_lw_loop
-
- leave_error
- moveq.b #1,d3
- rts
- leave_okdelay
- movem.l (sp)+,a0-1/d0-1
- bra.s leave_ok_nodisk
- leave_ok
- bsr activatebootsel
- leave_ok_nodisk
- moveq.b #0,d3
- rts
-
- * result : d0= 0 if disk is bootable
- test_boot
- move.w #$5,io_command(a1) ;declare the buffer to be invalid
- jsr _lvodoio(a6)
- move.l #2*512,io_length(a1)
- move.w #$2,io_command(a1) ;read bootblock
- move.l readbuf(pc),io_data(a1)
- jsr _lvodoio(a6)
- tst.l d0 ;any errors ?
- bne.s tb_error ;if then goto waitfordisk
- tb_calcsum
- cmp.w #35,20(a6) ; welche Kickstart, bitteschön ?
- bhi.s 1$
-
- move.l readbuf(pc),a0
- cmp.l #$444f5300,(a0) ;check if DOS,0 [could be FFS,0 as well]
- bne.s tb_error ; bei 2.0 ist FFS auch gültig !!!!
- 1$ moveq.l #0,d0
- move.w #$00ff,d1 ;calculate checksum of bootblock
- move.l readbuf(pc),a0
- tb_schleife
- add.l (a0)+,d0
- bcc.s tb_nof
- addq.l #1,d0
- tb_nof dbf d1,tb_schleife
- not.l d0
- beq.s tb_fine ;if zero, disk is bootable
- tb_error
- clr.l io_length(a1) ;switch off motor
- move.w #$9,io_command(a1)
- jsr _lvodoio(a6) ;[if io_length=0 motor off, if 1 then on]
- moveq.l #1,d0
- rts
- tb_fine
- clr.l io_length(a1) ;switch off motor
- move.w #$9,io_command(a1)
- jsr _lvodoio(a6) ;[if io_length=0 motor off, if 1 then on]
- moveq.l #0,d0
- rts
-
-
- strktptr dc.l 0 ;pointer to our special structure
- gfxbase dc.l 0 ;...
- gfxname dc.b 'graphics.library',0
- even
- konst dc.b $0,$5,$a,0 ;here we put the color specified by -c
- white dc.b $f,$f,$f,0 ;data for white color.
- iorequests ds.l 6
- packflag dc.w 0
- ; intstuff
-
-
- dc.b 'BPic'
- coldcaproutine
- getexe
- move.l $fc0010,d0
- cmp.l $14(A6),d0
- beq.s 3$
- jmp $fc01ce
- 3$
- move.l a0,$2a(a6)
- move.l $3e(a6),a3
- move.w #-1,d0
- 2$ move.w #$f00,$dff180
- dbf d0,2$
- bchg #1,$bfe001
- jmp $fc01aa
-
- coldcapoff equ idendity+(coldcaproutine-begincopy)
-
- * This routine unpacks the BODY-chunk
- * a3 holds a pointer to the packed BODY-data
- * a2 must contain pointer to bm_planes
- * bm_depth must be put in d4
- * bm_bytesperrow could be put in d2 and bm_height could be put in d3
- * [to include this in your own programms, it has to be slightly modified.]
-
- unpackbody
- movem.l d0-7/a0-6,-(sp)
- moveq.w #0,d5
- move.w depth(a5),d4
- lea.l bm_planes(a5),a2
- cmp.b #1,mask(a5)
- bne.s unpackline
- addq.w #1,d4
- UnpackLine
- clr.l d6
- UnpackPlane
- move.w bm_bytesperrow(a5),d0
- mulu d5,d0
- move.l d0,a4
- asl #2,d6
- add.l 0(a2,d6.w),a4
- asr #2,d6
- move.l a4,a6
- add.w bm_bytesperrow(a5),a6
- clr.l d0
- CheckPacked
- move.b (a3)+,d0
- cmp.b #128,d0
- bhi.s GoOn
- beq.s CheckFinished
- FinishLine
- move.b (a3)+,(a4)+
- subq.b #1,d0
- bpl.s FinishLine
- bra.s CheckFinished
- GoOn move.b (a3)+,d1
- StoreByte
- move.b d1,(a4)+
- addq.b #1,d0
- cmp.b #1,d0
- bne.s StoreByte
- CheckFinished
- cmp.l a4,a6
- bhi.s CheckPacked
- addq.w #1,d6
- cmp.w d4,d6
- bne.s UnpackPlane
- GoOnLoop
- addq.w #1,d5
- cmp.w bmh(a5),d5
- bne.s UnpackLine
- movem.l (sp)+,d0-7/a0-6
- rts
-
- * reads out the colors of a colormap and stores it in a piece of memory [200
- * Bytes required ] in the following form:
- * 1st byte r, 2nd byte g and in 3rd byte b. Then the next color appears.
- * parms: a2=pointer to memory a3=pointer to Colormap a6=gfxbase
-
- getcols
-
- movem.l d0-2/a0-2,-(sp)
- moveq.w #0,d2
- 1$ move.l a3,a0
- move.l d2,d0
- jsr _lvogetrgb4(a6)
- move.b d0,2(a2) ;b
- and.b #%1111,2(a2)
- lsr.w #4,d0
- move.b d0,1(a2) ;g
- and.b #%1111,1(a2)
- lsr.w #4,d0
- move.b d0,(a2) ;r
- addq.w #1,d2
- add.l #3,a2
- cmp.w 2(a3),d2
- bne.s 1$
- movem.l (sp)+,d0-2/a0-2
- rts
-
- * fades out a viewport to a specified color [this color must be given in a
- * special format: 1st byte r, 2nd g and 3rd b.(4th=0)]
- * before fading out it is advisable to save the colors with getcols
- * parms: a3=viewport a4=pointer to color d0=delaytime (see below)
- * [a5=dosbase] a6=gfxbase
-
- fadeout
- movem.l d0-7/a0-6,-(sp)
- move.l 4.w,a6
- move.l #100,d0
- move.l #$10001,d1
- jsr _lvoallocmem(a6)
- move.l d0,a2
- move.l 4(a3),a3
- move.l 56(sp),a6
- bsr getcols
- move.w 2(a3),a3
- move.l a2,a5
- 1$ moveq.b #0,d7
- moveq #2,d5
- moveq #0,d6
- 2$ moveq #0,d4
- move.l a5,a2
- 3$ move.b (a2),d1
- move.b 1(a2),d2
- move.b 2(a2),d3
- move.b 0(a4,d6.w),d0
- cmp.b 0(a2,d6.w),d0
- blt.s 5$
- beq.s 4$
- addq.b #1,0(a2,d6.w)
- bra.s 6$
- 5$ subq.b #1,0(a2,d6.w)
- 6$ moveq.b #1,d7
- 4$ move.w d4,d0
- move.l 44(sp),a0 ;viewport
- move.l 56(sp),a6
- jsr _lvosetrgb4(a6)
- add.l #3,a2
- addq.w #1,d4
- cmp.w a3,d4
- bne.s 3$
- ; move.l (sp),d1 ;we're before boot up so we can't use dos.lib.
- ; move.l 52(sp),a6 ;so we help ourselves with dbf.
- ; jsr _lvodelay(a6) ;delay just needed if less then 32 colors.
- move.l (sp),d0
- 10$ dbf d0,10$
- addq.w #1,d6
- dbf d5,2$
- tst.b d7
- bne.s 1$
- move.l 4.w,a6
- move.l a5,a1
- move.l #100,d0
- jsr _lvofreemem(a6)
- movem.l (sp)+,d0-7/a0-6
- rts
-
- * fades in a viewport from a specified color [this color must be given in a
- * special format: 1st byte r, 2nd g and 3rd b.(4th=0)]
- * parms: a2=pointer to coltab as given by getcols a3=viewport
- * a4=pointer to color d0=delaytime (see above) [a5=dosbase] a6=gfxbase
-
- fadein
- movem.l d0-7/a0-6,-(sp)
- move.l 4(a3),a0
- move.w 2(a0),d0
- move.l a2,a0
- add.l #100,a0
- subq.w #1,d0
- 7$ move.b (a4),(a0)+
- move.b 1(a4),(a0)+
- move.b 2(a4),(a0)+
- dbf d0,7$
- move.l a2,a5
- 1$ move.w #0,a4
- moveq #2,d5
- moveq #0,d6
- 2$ moveq #0,d4
- move.l a5,a2
- 3$ move.b 100(a2),d1
- move.b 101(a2),d2
- move.b 102(a2),d3
- move.b 0(a2,d6.w),d0
- cmp.b 100(a2,d6.w),d0
- beq.s 4$
- blt.s 5$
- addq.b #1,100(a2,d6.w)
- bra.s 6$
- 5$ subq.b #1,100(a2,d6.w)
- 6$ move.w #1,a4
- 4$ move.w d4,d0
- move.l a3,a0
- move.l 56(sp),a6 ;gfxbase from Stack
- jsr _lvosetrgb4(a6)
- add.l #3,a2 ;step to the data of the next colour
- addq #1,d4 ;count the number of colours that we modified
- move.l 4(a3),a0 ;vport->colormap to a0
- cmp.w 2(a0),d4 ;compare the number of colours with our colour
- ;counter
- bne.s 3$ ;have we already modified all colours ?If not
- ;then let's modify the next one
- ; move.l (sp),d1 ;see above
- ; move.l 52(sp),a6
- ; jsr _lvodelay(a6)
- move.l (sp),d0
- 10$ dbf d0,10$
- addq.w #1,d6 ;now it's the next component's turn to be changed
- dbf d5,2$ ;we must do this loop three times:once for red,
- ;once for green and once for blue,
- ;so we load d5 with 2!!(3-1) in the beginning
- cmp.w #0,a4 ;(tst.w a4 doesn't work) find out if any changes were
- bne.s 1$ ;done in this loop,if not then we are ready
- movem.l (sp)+,d0-7/a0-6 ;clean up stackpointer
- rts
-
- device_support
-
- modulestart dc.l 0
- modlength dc.l 0
- i_server dc.l 0,0
- dc.b 2,0
- dc.l 0 ;10 name
- dc.l 0,0 ;18 irupt
-
- i_name dc.b 'BPic1.2_Color_Cycling',0
- even
- delaytime dc.w 0
- delaycurrent dc.w 0
-
- cm_length equ 80
-
- getpalette
- movem.l a0-6/d0-7,-(sp)
- move.w cycflag(pc),d0
- beq.s 11$
- m_alloc #clear+public,#cm_length
- emove d0,palette(pc)
- getgfx
- move.l palette(pc),a2
- moveq.w #0,d2
- 1$ lea.l viewport(a5),a0
- move.l 4(a0),a0
- move.w d2,d0
- call getrgb4
- move.w d0,(a2)+
- addq.w #1,d2
- cmp.w #33,d2
- bne.s 1$
- getexe
- ; interrupt einbinden
- lea i_server(pc),a1
- emove i_name(pc),10(a1)
- elea cg_interrupt(pc),18(a1)
- moveq.l #5,d0
- getexe
- call addintserver
- 11$ movem.l (sp)+,a0-6/d0-7
- rts
-
- palette dc.l 0
- cmap dc.l 0
-
-
- freepalette
- move.w cycflag(pc),d0
- beq.s 4$
- m_free palette(pc),#cm_length
- ; interrupt entfernen
- lea i_server(pc),a1
- moveq.l #5,d0
- getexe
- call remintserver
-
- 4$ rts
-
- rsreset
-
- crng_flag rs.w 1
- crng_ticks rs.w 1
- crng_start rs.b 1
- crng_end rs.b 1
- crng_ticked rs.w 1
-
- rsreset
-
-
- crngs ds.w 7*4
- dc.l 0
-
- cg_interrupt
- movem.l a0-6/d0-7,-(sp)
- lea crngs(pc),a2
- moveq.l #0,d7
- cg_begin
-
- addq.l #1,d7
- cmp.w #7,d7
- beq cg_finito
- add.w #1,crng_ticked(a2)
- move.w crng_ticks(a2),d0
- cmp.w crng_ticked(a2),d0
- bhi.s cg_end
- clr.w crng_ticked(a2)
- move.l palette(pc),a0
- moveq.w #0,d1
- move.b crng_start(a2),d1
- lsl.w #1,d1
- moveq.l #0,d2
- move.b crng_end(a2),d2
- lsl.w #1,d2
- cmp.w d1,d2
- beq cg_end
- btst #1,crng_flag+1(a2)
- bne.s cg_backward
- move.w 0(a0,d2.w),d6
- 11$ subq.w #2,d2
- move.w 0(a0,d2.w),2(a0,d2.w)
- cmp.w d1,d2
- bne.s 11$
- move.w d6,0(a0,d2.w)
- bra.s cg_end
- cg_backward
- move.w 0(a0,d1.w),d6
- 11$ addq.w #2,d1
- move.w 0(a0,d1.w),-2(a0,d1.w)
- cmp.w d1,d2
- bne.s 11$
- move.w d6,0(a0,d1.w)
-
- cg_end
- addq.l #8,a2
- bra.s cg_begin
- cg_finito
- move.l vv_viewport(pc),a0
- moveq.l #32,d0
- move.l palette(pc),a1
- getgfx
- call loadrgb4
- movem.l (sp)+,a0-6/d0-7
- moveq.l #0,d0
- rts
-
- vv_viewport dc.l 0
- readbuf dc.l 0
- kickflag dc.w 1 ; depends on checkdrive
- cycflag dc.w 0
- endcopy
- ; opt p-
-
- allmeml equ endcopy-begincopy+code+100
-
-
- filegdef
- dc.w 85,16,304,8,4,3,-78
- dc.l filetxt
- dc.w 300,32,70,11,1,0,11
- dc.l canctxt
- canctxt dc.b 'Cancel',0
- even
- filetxt dc.b 'IFF-File:',0
- even
-
- reqtext dc.b 'Please enter IFF-Filename :',0
- even
-
- arpcode
- clr.l 30(a0)
- move.w #1,46(a0)
- move.w #50,2(a0)
- rts
-
- _lvotackon equ -624
- _lvofilerequest equ -294
-
- * gadgetmem =zeiger auf speicherbereich 50 Byte direct. 50 Byte filename
- * 100 Bytes: path
- getfilename
- movem.l d2-5/a2-5,-(sp)
-
- tst.l arpbase
- beq 8$
- move.l a0,-(sp)
- move.l gadgetmem(pc),a0
- add.l #bufferstart+200,a0
- move.l a0,4(a0)
- move.l a0,8(a0)
- sub.l #150,4(a0)
- sub.l #200,8(a0)
- move.l (sp)+,a1
- move.l a1,(a0)
- move.b #8,16(a0)
- lea arpcode(pc),a1
- move.l a1,18(a0)
- getarp
- jsr _lvofilerequest(a6)
- tst.l d0
- beq 1$
- move.l gadgetmem(pc),a2
- add.l #bufferstart+100,a2
- lea -100(a2),a1
- move.l a2,a0
- 3$ move.b (a1)+,(a2)+
- bne.s 3$
- move.l d0,a1
- jsr _lvotackon(a6)
-
- moveq.w #1,d0
- bra 1$
- 8$ move.l 4.w,a6
- move.l #420,d0
- move.l #$10000+1,d1
- jsr _lvoallocmem(a6)
- move.l d0,a3
- beq 1$
- lea.l filegdef(pc),a1
- move.l a3,a2
- bsr makegadget
- move.w #1,itext1+it_topedge(a2)
- clr.w itext2+it_topedge(a2)
- elea 280(a3),gd_specialinfo(a2)
- elea 320(a3),280+4(a3) ;undobuffer
- move.w #98,280+10(a3) ;zeichenzahl
- move.l gadgetmem(pc),a0
- elea bufferstart+100(a0),280(a3)
-
- add.l #18,a1
- add.l #140,a2
- move.l a2,-140(a2)
- bsr makegadget
-
-
-
- move.l a3,newwindow+18
- move.w #180,newwindow
- move.w #80,newwindow+2
- move.w #400,newwindow+4
- move.w #50,newwindow+6
- move.w #$0102,newwindow+8
- move.l #$40,newwindow+10
- move.l #$1000+6,newwindow+14
- bsr openwin
- move.l a0,a4
-
- getint
- move.l a3,a0
- move.l a4,a1
- sub.l a2,a2
- jsr _lvoactivategadget(a6)
- move.l wd_userport(a4),a2
- bsr waitmsg
- move.l 28(a1),a5
- jsr _lvoreplymsg(a6)
- move.l a4,a0
- getint
- jsr _lvoclosewindow(a6)
- move.l 4.w,a6
- move.l a3,a1
- move.l #420,d0
- jsr _lvofreemem(a6)
- move.w gd_gadgetid(a5),d0
- 1$ movem.l (sp)+,d2-5/a2-5
- rts
-
-
-
- infowindow
- movem.l d2-5/a2-5,-(sp)
- move.l 4.w,a6
- move.l #140,d0
- move.l #$10000+1,d1
- jsr _lvoallocmem(a6)
- move.l d0,a3
- beq 1$
- lea.l infogdef(pc),a1
- move.l a3,a2
- bsr makegadget
- move.l a3,newwindow+18
- move.w #180,newwindow
- move.w #45,newwindow+2
- move.w #280,newwindow+4
- move.w #150,newwindow+6
- move.w #$0102,newwindow+8
- move.l #$40,newwindow+10
- move.l #$1000+6,newwindow+14
- bsr openwin
- move.l a0,a4
- move.l rastport(pc),-(sp)
- move.l wd_rastport(a4),rastport
-
- move.w #15,d2
- move.w #13,d3
- lea infotext2(pc),a5
- moveq.w #9,d5
- 2$ add.w #10,d3
- move.l a5,a2
- bsr schatten
- add.l d0,a5
- addq.l #1,a5
- dbf d5,2$
-
- move.l wd_userport(a4),a2
- bsr waitmsg
- jsr _lvoreplymsg(a6)
- getint
- move.l a4,a0
- jsr _lvoclosewindow(a6)
- move.l 4.w,a6
- move.l a3,a1
- move.l #140,d0
- jsr _lvofreemem(a6)
- move.l (sp)+,rastport
- 1$ movem.l (sp)+,d2-5/a2-5
- rts
-
-
- infogdef
- dc.w 120,125,40,11,1,0,11
- dc.l infotext
- infotext dc.b 'Ok',0,0
- infotext2 dc.b ' This Programm is SHAREWARE',0
- dc.b ' It replaces the standard Boot-',0
- dc.b 'hand by any given IFF-file and',0
- dc.b 'additionally plays a MED-Module.',0
- dc.b ' If you like it please send',0
- dc.b ' 5$ or 5DM to the author:',0
- dc.b ' Andreas Ackermann',0
- dc.b ' Lorenz-Summa-Str. 10',0
- dc.b ' W-8679 Oberkotzau',0
- dc.b ' GERMANY',0
- even
- initwindow
- movem.l d2-4/a2-4,-(sp)
- move.l 4.w,a6
- move.l #gadgetmemsize,d0
- move.l #$10000+1,d1
- jsr _lvoallocmem(a6)
- move.l d0,gadgetmem
- beq nogadgetmem
- lea.l gdef(pc),a1
- move.l gadgetmem(pc),a2
- moveq.w #4,d0 ; vorher 3
- 1$ bsr makegadget
- move.l a2,(a2)
- add.l #140,(a2)
- add.l #140,a2
- add.l #18,a1
- dbf d0,1$
- clr.l -140(a2)
- add.w #$100,-140+gd_activation(a2)
- add.w #$100,-280+gd_activation(a2)
- move.l gadgetmem(pc),newwindow+18
- bsr openwin
- move.l wd_userport(a0),userport
- move.l wd_rastport(a0),rastport
- move.l a0,windowptr
- beq nowindow
-
- move.w #10,d2
- move.w #154,d3 ; vorher 134
- lea stat(pc),a2
- bsr schatten
- getint
- lea.l imagestruct(pc),a1
- move.l rastport(pc),a0
- clr.l d0
- clr.l d1
- jsr _lvodrawimage(a6)
-
- moveq.w #1,d0
- movem.l (sp)+,d2-4/a2-4
- rts
-
-
- windowcleanup
- movem.l d2-4/a2-4,-(sp)
- move.l windowptr(pc),a0
- getint
- jsr _lvoclosewindow(a6)
- nowindow
- move.l 4.w,a6
- move.l gadgetmem(pc),a1
- move.l #gadgetmemsize,d0
- jsr _lvofreemem(a6)
- nogadgetmem
- clr.l d0
- movem.l (sp)+,d2-4/a2-4
- rts
-
- userport dc.l 0
- rastport dc.l 0
- windowptr dc.l 0
- gadgetmem dc.l 0
-
- newwindow
- dc.w 100,30,450,165
- dc.b 2,3
- dc.l $200+$40,$1000+14 ;closew|gadup,wdrag|wdepth|wclose|activate
- dc.l 0,0
- dc.l windowname
- dc.l 0,0
- dc.w 10,10,640,256
- dc.w 1
-
- windowname dc.b 'BootPic V2.1b ©1992 by Acki',0
- even
-
- openwin ;windowptr=>a0
- move.l intbase(pc),a6
- lea newwindow(pc),a0
- jsr _lvoopenwindow(a6)
- move.l d0,-(sp)
- beq.s 1$
- move.l d0,a0
- move.l wd_rastport(a0),a2
- getgfx
- moveq.w #1,d0
- move.l a2,a1
- jsr _lvosetapen(a6)
- move.l a2,a1
- moveq.w #4,d0
- move.w #11,d1
- lea newwindow(pc),a0
- move.w 4(a0),d2
- subq.w #5,d2
- move.w 6(a0),d3
- subq.w #3,d3
- jsr _lvorectfill(a6)
- clr.w d0
- move.l a2,a1
- jsr _lvosetdrmd(a6)
- move.l newwindow+18,a0
- sub.l a2,a2
- move.l (sp),a1
- moveq.l #7,d0 ;max gadgetanzahl
- getint
- jsr _lvorefreshglist(a6)
- 1$ move.l (sp)+,a0
- rts
-
-
- ;d2=x-pos, d3=y-pos a2=^auf Text erg:d0=länge
-
- schatten
- moveq.w #2,d0
- addq.w #1,d2
- addq.w #1,d3
- bsr pencrsr
- move.l a2,a0
- bsr printtext
- moveq.w #3,d0
- subq.w #1,d2
- subq.w #1,d3
- bsr pencrsr
- move.l a2,a0
- bsr printtext
- rts
-
- pencrsr ; d0=>pen ,d2=>x d3=>y
- getgfx
- move.l rastport(pc),a1
- jsr _lvosetapen(a6)
- move.w d2,d0
- move.w d3,d1
- move.l rastport(pc),a1
- jsr _lvomove(a6)
- rts
-
- printtext
- getgfx
- move.w #-1,d0
- move.l a0,a1
- 1$ addq.w #1,d0
- tst.b (a1)+
- bne.s 1$
- move.w d0,-(sp)
- move.l rastport(pc),a1
- jsr _lvotext(a6)
- moveq #0,d0
- move.w (sp)+,d0
- rts
-
- * a1=>auf gadgetdef a2=>auf memory (möglichst genug !!!)
-
- makegadget
- add.w #1,width(a1)
- move.w width(a1),koords+4(a2)
- move.w width(a1),koords+8(a2)
- sub.w #1,width(a1)
- add.w #1,height(a1)
- move.w height(a1),koords+10(a2)
- move.w height(a1),koords+14(a2)
- sub.w #1,height(a1)
- move.l #-1,render1+bd_leftedge(a2)
- elea koords(a2),render1+bd_xy(a2)
- move.b #5,render1+bd_count(a2)
- move.b #2,render1+bd_frontpen(a2)
- elea render1(a2),gd_gadgetrender(a2)
- move.b #2,itext1+it_frontpen(a2)
- move.w #2,itext1+it_topedge(a2)
- move.w textx(a1),itext1+it_leftedge(a2)
- add.w #1,itext1+it_leftedge(a2)
- move.l textptr(a1),itext1+it_itext(a2)
- elea itext2(a2),itext1+it_nexttext(a2)
- move.b #3,itext2+it_frontpen(a2)
- move.w #1,itext2+it_topedge(a2)
- move.w textx(a1),itext2+it_leftedge(a2)
- move.l textptr(a1),itext2+it_itext(a2)
- elea itext1(a2),gd_gadgettext(a2)
- move.l leftedge(a1),gd_leftedge(a2)
- move.w height(a1),gd_height(a2)
- move.w width(a1),gd_width(a2)
- move.w #$1,gd_activation(a2)
- move.w type(a1),gd_gadgettype(a2)
- move.w id(a1),gd_gadgetid(a2)
- rts
-
- yesnowindow
- movem.l d2-5/a2-5,-(sp)
- move.l 4.w,a6
- move.l #300,d0
- move.l #$10000+1,d1
- jsr _lvoallocmem(a6)
- move.l d0,a3
- beq 1$
- lea.l qgdef(pc),a1
- move.l a3,a2
- bsr makegadget
- move.l a3,a2
- add.l #textptr+4,a1
- add.l #140,a2
- move.l a2,gd_nextgadget(a3)
- bsr makegadget
-
- move.l a3,newwindow+18
- move.w #140,newwindow
- move.w #100,newwindow+2
- move.w #335,newwindow+4
- move.w #50,newwindow+6
- move.w #$0102,newwindow+8
- move.l #$40,newwindow+10
- move.l #$1000+6,newwindow+14
- bsr openwin
- move.l a0,a4
- move.l rastport(pc),-(sp)
- move.l wd_rastport(a4),rastport
-
- move.w #30,d2
- move.w #22,d3
- lea qt(pc),a2
- bsr schatten
-
- move.l wd_userport(a4),a2
- bsr waitmsg
- move.l 28(a1),a0
- moveq.l #0,d5
- tst.w gd_gadgetid(a0)
- beq.s 27$
- addq.w #1,d5
- 27$
- jsr _lvoreplymsg(a6)
- getint
- move.l a4,a0
- jsr _lvoclosewindow(a6)
- move.l 4.w,a6
- move.l a3,a1
- move.l #300,d0
- jsr _lvofreemem(a6)
- move.l (sp)+,rastport
- move.l d5,d0
- 1$ movem.l (sp)+,d2-5/a2-5
- rts
- ; erg: d0= 0 when no
-
- rsreset
- gadgetdef rs.l 0
- leftedge rs.w 1
- topedge rs.w 1
- width rs.w 1
- height rs.w 1
- type rs.w 1
- id rs.w 1
- textx rs.w 1
- textptr rs.l 1
-
- qgdef dc.w 38,31,60,11,1,1,16
- dc.l yes
- dc.w 225,31,60,11,1,0,20
- dc.l no
-
-
-
- qt dc.b 'Do you wish to load a MED-Module ?',0
- even
- yes dc.b 'Yes',0
- no dc.b 'No',0
- even
- qtext dc.b 'Please select a MED-Module :',0
- even
-
-
- gdef dc.w 38,90,175,11,1,6,10
- dc.l loadt
- dc.w 238,90,175,11,1,7,32
- dc.l remtt
- dc.w 138,130,175,11,1,8,67
- dc.l infot
- dc.w 238,110,175,11,1,9,35
- dc.l cyct
- dc.w 38,110,175,11,1,10,29
- dc.l kickt
-
- imagestruct
- dc.w 77,28
- dc.w 284,39
- dc.w 1
- dc.l imagedata
- dc.b 2,1
- dc.l 0
-
- loadt dc.b 'Load Picture & Music',0
- even
- remtt dc.b 'Remove BootPic',0
- even
- infot dc.b 'Info',0
- even
- cyct dc.b 'Color-Cycling',0
- even
- kickt dc.b 'Check only df0:',0
- even
- stat dc.b 'Status:',0
- even
-
-
-
- section player,code_c
- playerstart
- include "modplayer.i"
- ; a0=ptr auf data
- ; d0=ptr auf länge
- _med_startup
-
- movem.l d0-7/a0-6,-(sp)
- move.l a0,a2
- move.l d0,d2
- getexe
- move.l #$10003,d1
- move.l a2,a0
- add.l d2,a0
- move.l -4(a0),d0
- lsr.l #8,d0
- addq.l #7,d0
- addq.l #7,d0
- move.l d0,pp_memlength
- call allocmem
- move.l d0,a1
- move.l d0,pp_memptr
- move.l a2,a0
- move.l 4(a0),d0
- add.l d2,a0
- bsr _pp_decrunchbuffer
- move.l pp_memptr(pc),a0
- cmp.l #'MMD0',(a0)
- bne.s 1$
- bsr _relocmodule
- move.l pp_memptr(pc),a0
- bsr _playmodule
- 1$ movem.l (sp)+,d0-7/a0-6
- rts
-
-
- pp_memlength dc.l 0
- pp_memptr dc.l 0
-
- _med_cleanup
- movem.l d0-7/a0-6,-(sp)
- getexe
- move.l pp_memlength(pc),d0
- beq.s 1$
- move.l pp_memptr(pc),a1
- call freemem
- clr.l pp_memlength
- 1$ movem.l (sp)+,d0-7/a0-6
- rts
-
-
-
-
- ; Function: _RelocModule(a0)
- ; a0 = pointer to module
- relocentr:
- tst.l (a0)
- beq.s norel
- add.l d1,(a0)
- norel: addq.l #4,a0
- rts
- _RelocModule:
- movem.l a2-a3/d2-d3,-(sp)
- movea.l a0,a2
- move.l a2,d1 ;d1 = ptr to start of module
- lea 8(a2),a0
- bsr.s relocentr ;reloc song ptr
- addq.l #4,a0
- bsr.s relocentr ;reloc blockarr ptr
- addq.l #4,a0
- bsr.s relocentr ;reloc smplarr ptr
- addq.l #4,a0
- bsr.s relocentr ;reloc expdata ptr
- movea.l 24(a2),a0
- movea.l 8(a2),a1
- moveq #0,d0
- move.b 787(a1),d0 ;number of samples
- subq.b #1,d0
- relocs: bsr.s relocentr
- move.l -4(a0),d3 ;sample ptr
- beq.s nosyn
- move.l d3,a3
- tst.w 4(a3)
- bpl.s nosyn ;type >= 0
- move.w 20(a3),d2 ;number of waveforms
- lea 278(a3),a3 ;ptr to wf ptrs
- subq.w #1,d2
- relsyn: add.l d3,(a3)+
- dbf d2,relsyn
- nosyn: dbf d0,relocs
- movea.l 16(a2),a0
- move.w 504(a1),d0
- subq.b #1,d0
- relocb: bsr.s relocentr
- dbf d0,relocb
- move.l 32(a2),d0 ;extension struct
- beq.s rel_ex
- move.l d0,a0
- addq.l #4,a0 ;pass "reserved"
- bsr.s relocentr ;InstrExt...
- addq.l #4,a0 ;pass sizes of InstrExt
- bsr.s relocentr ;annotxt
- rel_ex movem.l (sp)+,d2-d3/a2-a3
- rts
-
-
-
-
- ; call as:
- ; DecrunchBuffer (endcrun, buffer, efficiency);
-
-
- _pp_DecrunchBuffer:
- movem.l d1-d7/a2-a6,-(a7)
- bsr.s Decrunch
- movem.l (a7)+,d1-d7/a2-a6
- rts
- Decrunch:
- lea myBitsTable(PC),a5
- move.l d0,(a5)
- move.l a1,a2
- move.l -(a0),d5
- moveq #0,d1
- move.b d5,d1
- lsr.l #8,d5
- add.l d5,a1
- move.l -(a0),d5
- lsr.l d1,d5
- move.b #32,d7
- sub.b d1,d7
- LoopCheckCrunch:
- bsr.s ReadBit
- tst.b d1
- bne.s CrunchedBytes
- NormalBytes:
- moveq #0,d2
- Read2BitsRow:
- moveq #2,d0
- bsr.s ReadD1
- add.w d1,d2
- cmp.w #3,d1
- beq.s Read2BitsRow
- ReadNormalByte:
- move.w #8,d0
- bsr.s ReadD1
- move.b d1,-(a1)
- dbf d2,ReadNormalByte
- cmp.l a1,a2
- bcs.s CrunchedBytes
- rts
- CrunchedBytes:
- moveq #2,d0
- bsr.s ReadD1
- moveq #0,d0
- move.b (a5,d1.w),d0
- move.l d0,d4
- move.w d1,d2
- addq.w #1,d2
- cmp.w #4,d2
- bne.s ReadOffset
- bsr.s ReadBit
- move.l d4,d0
- tst.b d1
- bne.s LongBlockOffset
- moveq #7,d0
- LongBlockOffset:
- bsr.s ReadD1
- move.w d1,d3
- Read3BitsRow:
- moveq #3,d0
- bsr.s ReadD1
- add.w d1,d2
- cmp.w #7,d1
- beq.s Read3BitsRow
- bra.s DecrunchBlock
- ReadOffset:
- bsr.s ReadD1
- move.w d1,d3
- DecrunchBlock:
- move.b (a1,d3.w),d0
- move.b d0,-(a1)
- dbf d2,DecrunchBlock
- EndOfLoop:
- _pp_DecrunchColor:
- ; bchg #1,$bfe001
- ; move.w a1,$dff180
- btst.b #6,$bfe001
- beq.s 1$
- cmp.l a1,a2
- bcs.s LoopCheckCrunch
- 1$ rts
- ReadBit:
- moveq #1,d0
- ReadD1:
- moveq #0,d1
- subq.w #1,d0
- ReadBits:
- lsr.l #1,d5
- roxl.l #1,d1
- subq.b #1,d7
- bne.s No32Read
- move.b #32,d7
- move.l -(a0),d5
- No32Read:
- dbf d0,ReadBits
- rts
- myBitsTable:
- dc.b $09,$0a,$0b,$0b
-
-
- rs.b 20
- section bootpicdata,data_c
- imagedata
- dc.w $0000,$007f,$f800,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$1fe0,$0000,$0000,$6000,$0000,$0000
- dc.w $0000,$3fff,$ff80,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$003f,$fffe,$0000,$0000,$fc00,$0000,$0000
- dc.w $0007,$ffff,$ffe0,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$01ff,$ffff,$8000,$0000,$fe00,$0000,$0000
- dc.w $000f,$ffff,$fff0,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$03ff,$ffff,$e000,$0001,$fe00,$0000,$0000
- dc.w $000f,$ffff,$fff8,$0000,$0000,$0000,$0000,$0000,$0000,$0180,$0000,$03ff,$ffff,$f000,$0001,$fc00,$0000,$0000
- dc.w $000f,$ffff,$fffc,$0000,$0000,$0000,$0000,$0000,$0000,$03e0,$0000,$003f,$ffff,$f800,$0001,$fc00,$0000,$0000
- dc.w $0000,$1ff8,$07fc,$0000,$0000,$0000,$0000,$0000,$0000,$07e0,$0000,$007f,$f83f,$f800,$0000,$f800,$0000,$0000
- dc.w $0000,$3fe0,$03fc,$0000,$0000,$0000,$0000,$0000,$0000,$0fe0,$0000,$00ff,$c00f,$fc00,$0000,$7000,$0000,$0000
- dc.w $0000,$3fc0,$03fc,$0000,$0000,$0000,$0000,$0000,$0000,$1fe0,$0000,$01ff,$8007,$fc00,$0000,$0000,$0000,$0000
- dc.w $0000,$7fc0,$07fc,$0000,$00e0,$0000,$0000,$e000,$0000,$3fc0,$0000,$01ff,$0007,$fc00,$0000,$0000,$0000,$0000
- dc.w $0000,$ff80,$0ffc,$0000,$03f0,$0000,$0003,$f000,$0000,$7f80,$0000,$03ff,$000f,$fc00,$0000,$0000,$0000,$0000
- dc.w $0000,$ff80,$1ff8,$0000,$0ff8,$0000,$000f,$f800,$0000,$ff80,$0000,$07fe,$001f,$f800,$0000,$0000,$0000,$fe00
- dc.w $0001,$ff00,$3ff8,$0000,$3ff8,$0000,$003f,$f800,$000f,$fffe,$0000,$0ffc,$003f,$f800,$0000,$0000,$0003,$ff80
- dc.w $0003,$ff00,$fff0,$0000,$fff8,$0000,$00ff,$f800,$001f,$ffff,$0000,$0ffc,$00ff,$f000,$001c,$0000,$001f,$ffe0
- dc.w $0003,$fe03,$ffe0,$0003,$ffff,$8000,$03ff,$ff80,$001f,$ffff,$0000,$1ff8,$01ff,$e000,$003f,$0000,$007f,$fff0
- dc.w $0007,$fe0f,$ff80,$0007,$ffff,$e000,$07ff,$ffe0,$001f,$ffff,$0000,$3ff8,$07ff,$c000,$003f,$8000,$01ff,$fff0
- dc.w $0007,$ffff,$ff00,$001f,$ff07,$f800,$1fff,$07f8,$0003,$fe00,$0000,$7ff0,$1fff,$8000,$007f,$8000,$03ff,$8ff0
- dc.w $000f,$ffff,$fc00,$003f,$fc07,$f800,$3ffc,$07f8,$0007,$f800,$0000,$7fe0,$7fff,$0000,$00ff,$0000,$07fe,$0ff0
- dc.w $001f,$ffff,$f800,$007f,$f007,$fc00,$7ff0,$07fc,$000f,$f000,$0000,$ffe1,$fffe,$0000,$01fe,$0000,$0ff8,$07f0
- dc.w $001f,$ffff,$c000,$00ff,$e007,$fc00,$ffe0,$07fc,$001f,$e000,$0001,$ffff,$fff8,$0000,$01fe,$0000,$1ff0,$07c0
- dc.w $003f,$ffff,$f000,$01ff,$c007,$fc01,$ffc0,$07fc,$001f,$e000,$0001,$ffff,$ffe0,$0000,$03fc,$0000,$3fe0,$0000
- dc.w $007f,$ffff,$f800,$01ff,$8007,$fc01,$ff80,$07fc,$003f,$c000,$0003,$ffff,$ff80,$0000,$07f8,$0000,$7fc0,$0000
- dc.w $007f,$f80f,$fc00,$03ff,$000f,$fc03,$ff00,$0ffc,$003f,$c000,$0003,$ffff,$fe00,$0000,$07f8,$0000,$ff80,$0000
- dc.w $00ff,$f007,$fc00,$03fe,$000f,$f803,$fe00,$0ff8,$007f,$8000,$0007,$fe7f,$f800,$0000,$0ff0,$0001,$ff80,$0000
- dc.w $01ff,$e007,$fc00,$07fe,$001f,$f807,$fe00,$1ff8,$007f,$8000,$000f,$fe3f,$c000,$0000,$1fe0,$0001,$ff00,$0000
- dc.w $01ff,$c007,$fc00,$07fc,$001f,$f007,$fc00,$1ff0,$00ff,$0000,$000f,$fc00,$0000,$0000,$3fc0,$0003,$fe00,$0000
- dc.w $03ff,$800f,$fc00,$07fc,$003f,$f007,$fc00,$3ff0,$00ff,$0000,$001f,$fc00,$0000,$0000,$3fc0,$0003,$fe00,$0000
- dc.w $07ff,$001f,$f800,$0ff8,$007f,$e00f,$f800,$7fe0,$01fe,$0000,$003f,$f800,$0000,$0000,$7f80,$0007,$fc00,$0000
- dc.w $0ffe,$003f,$f800,$0ff8,$00ff,$c00f,$f800,$ffc0,$01fc,$0000,$003f,$f000,$0000,$0000,$ff80,$0007,$fc00,$0000
- dc.w $0ffc,$007f,$f000,$0ff8,$01ff,$800f,$f801,$ff80,$03fc,$0000,$007f,$f000,$0000,$0000,$ff00,$0007,$fc00,$0000
- dc.w $1ff8,$00ff,$e000,$0ff8,$03ff,$000f,$f803,$ff00,$03f8,$0000,$007f,$e000,$0000,$0001,$ff00,$0007,$fc00,$0000
- dc.w $3ff8,$03ff,$c000,$07f8,$07fe,$0007,$f807,$fe00,$07f8,$0000,$00ff,$e000,$0000,$0001,$fe00,$0007,$fc00,$0000
- dc.w $7ff8,$0fff,$0000,$07f8,$0ffc,$0007,$f80f,$fc00,$07f0,$0000,$01ff,$c000,$0000,$0003,$fc00,$0007,$fc00,$7000
- dc.w $7fff,$fffe,$0000,$03fc,$3ff8,$0003,$fc3f,$f800,$0ff0,$0000,$01ff,$8000,$0000,$0007,$fc00,$0007,$ff07,$f800
- dc.w $ffff,$fffc,$0000,$03ff,$ffe0,$0003,$ffff,$e000,$0ff0,$0000,$03ff,$8000,$0000,$0007,$f800,$0007,$ffff,$f000
- dc.w $ffff,$fff0,$0000,$01ff,$ffc0,$0001,$ffff,$c000,$0ff0,$0000,$03ff,$0000,$0000,$000f,$f800,$0003,$ffff,$f000
- dc.w $ffff,$ffc0,$0000,$00ff,$ff00,$0000,$ffff,$0000,$07f0,$0000,$03ff,$0000,$0000,$000f,$f000,$0001,$ffff,$c000
- dc.w $7e0f,$ff00,$0000,$003f,$f800,$0000,$3ff8,$0000,$01f0,$0000,$01fe,$0000,$0000,$000f,$f000,$0000,$7fff,$0000
- dc.w $1c03,$f800,$0000,$000f,$c000,$0000,$0fc0,$0000,$0070,$0000,$0078,$0000,$0000,$0007,$e000,$0000,$1ff0,$0000
-
- end
-
-
-
-
-
-
-
-
-
-
-
-