BMP FMV !!!

Announce (tech) demos or games releases

Moderator: Mask of Destiny

Post Reply
User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

BMP FMV !!!

Post by TmEE co.(TM) » Thu Aug 23, 2007 12:20 pm

http://www.hot.ee/tmeeco/DWNLOADS/CAR.RAR

At my relative, inspired by his cool comics, I decided to make my own, but instead of a comic I got a movie, and here it is !!!

That program plays 72 frames of 4-bit 320x240 Windows BMPs as fast as machine would go (waits for VBL after BMP drawn)... I could speed it up by removing pattern table setups after each frame, but I didn't...

Plays on PAL and NTSC machines, but I recommend PAL as the BMPs are 320x240 not 320x224...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

User avatar
Stef
Very interested
Posts: 2945
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Aug 25, 2007 11:03 am

very fun !
I do like it much, the frame rate isn't bad for a complete screen refresh !

User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Aug 25, 2007 12:14 pm

Thanks, everyone who have seen it liked it :)

It runs around 10 FPS, uses few bytes of RAM and no DMA...
If anyone want's the BMP loader just ask.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Chilly Willy
Very interested
Posts: 2736
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Aug 25, 2007 5:09 pm

With the settings I use in DGen on the PSP, it runs at 60 FPS. :D

It was VERY smooth. Does the content affect the speed? I was just wondering why you used a little drawing instead of some actual film clip.

User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Tue Aug 28, 2007 12:16 pm

I didn't use film clip because :

* I have no tools to mess with film clips
* I got the idea to make BMP FMV after drawing that crap

And 10FPS is on real MD, and the content doesn't affect anything, only image size. Images are not compressed at all, not they're tiled, just plain 4-bit BMP files which MS-PAINT generates :wink:
If I had converted to tiles then much higher frame rate would be possible... but that was just a fun stuff... nothing so serious that I have to spend more time on it...
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Chilly Willy
Very interested
Posts: 2736
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Aug 28, 2007 8:12 pm

Yeah, but it's rather nifty anyway. Real hardware is limited on things like DMA which emulators can ignore for better speed on slower systems. That's probably what's making it so fast on the PSP.

User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed Aug 29, 2007 12:38 pm

DrMD on my GP32 runs it too fast too, I have to put frameskip 0 and 66MHz to see anything !!!
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

RedAngel
Interested
Posts: 14
Joined: Wed Feb 07, 2007 7:29 pm

Post by RedAngel » Thu Aug 30, 2007 9:10 am

Could you post the BMP loader?. I would like to try it.

User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu Aug 30, 2007 6:00 pm

Here's the BMP loader, BMPX and BMPY are LONG variables, DPORT is VDP DATA port, CPORT is VDP Control port and PTADDR is the address of the pattern table in VRAM

Code: Select all

LoadBMP:                ; Loads an 4-bit BMP, A0 = Source, D4 = Start tile
 MOVE.L #DPORT, A3
 ADD.L  #2, A0          ; ID WORD, must be "BM"
 ADD.L  #4, A0          ; Size LONG
 ADD.L  #4, A0          ; nothing
 ADD.L  #4, A0          ; Image type LONG, must be 1078
 ADD.L  #4, A0          ; Header size LONG, must be 40
 MOVE.L (A0)+, D0       ; Width LONG
 ROR.W  #8, D0
 SWAP   D0
 ROR.W  #8, D0
 MOVE.L D0, (BMPX)      
 MOVE.L (A0)+, D0       ; Height LONG
 ROR.W  #8, D0
 SWAP   D0
 ROR.W  #8, D0
 MOVE.L D0, (BMPY)
 ADD.L  #2, A0          ; 1 WORD
 ADD.L  #2, A0          ; bpp WORD, must be 4
 ADD.L  #4, A0          ; compression LONG, must be 0
 ADD.L  #4, A0          ; (compressed) image size LONG
 ADD.L  #16, A0         ; Nothing
 MOVE.L #$C0000000, (CPORT) ; BMP palette format B, G, R, Z
 MOVE.W #15, D3
BMPpalLoop:
 MOVE.B (A0)+, D0       ; R
 AND.L  #$E0, D0
 LSL.W  #4, D0
 MOVE.B (A0)+, D1       ; G
 AND.L  #$E0, D1
 MOVE.B (A0)+, D2       ; B
 AND.L  #$E0, D2
 LSR.W  #4, D2
 OR.W   D2, D0
 OR.W   D1, D0
 ADD.L  #1, A0          ; Z
 MOVE.W D0, (DPORT)
 DBRA   D3, BMPpalLoop
 MOVE.W D4, D0          ; D4=Start tile
 LSL.W  #5, D0
 AND.L  #$FFFF, D0
 MOVE.L #$40000000, D2  ; D2=VDP command
 MOVE.L D0, D1
 LSR.L  #8, D1
 LSR.L  #6, D1
 OR.L   D1, D2          ; Add Address bits 14 and 15
 MOVE.L D0, D1
 AND.L  #$3FFF,D1
 SWAP   D1
 OR.L   D1, D2          ; Add rest of the Address bits
 MOVE.L D2, (CPORT)     ; Write command+screen pointer
 MOVE.L A0, A1
 MOVE.L (BMPY), D6
 SUBQ.L #1, D6
 LSR.L  #3, D6
ImageLoopY:
 MOVE.L A1, A2
 MOVE.L (BMPX), D7
 SUBQ.L #1, D7
 LSR.L  #3, D7
TileLoop:
 MOVE.L A2, A0
 MOVE.L (BMPX), D0
 LSR.L  #1, D0
 MOVE.L (A0), (A3)      ; Load one tile
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 MOVE.L (A0), (A3)
 ADD.L  D0, A0
 ADD.L  #4, A2
 DBRA   D7, TileLoop
 ADD.L  (BMPX), A1
 ADD.L  (BMPX), A1
 ADD.L  (BMPX), A1
 ADD.L  (BMPX), A1
 DBRA   D6, ImageLoopY
 MOVE.L (BMPY), D1      ; Tiles loaded, now display
 SUBQ.L #1, D1
 LSR.L  #3, D1
 MOVE.W D1, D7
 MOVE.W #29, D0         ; Center image Y
 SUB.W  D1, D0
 LSR.W  #1, D0
 ADD.W  D1, D0
 MOVE.L (BMPX), D2
 SUBQ.L #1, D2
 LSR.L  #3, D2
 MOVE.W #39, D1         ; Center image X
 SUB.W  D2, D1
 LSR.W  #1, D1
 MOVE.W D4, D3          ; D3 = Start tile
 OR.W   #$1000, D3
Yloop2:                  
 JSR    CalcOffset
 MOVE.L (BMPX), D6
 SUBQ.L #1, D6
 LSR.L  #3, D6
Xloop2:
 MOVE.W D3, (A3)
 ADDQ.W #1, D3
 DBRA   D6, Xloop2
 SUBQ.W #1, D0
 DBRA   D7, Yloop2
 RTS

CalcOffset:             ; Calculates offset in VRAM for pattern table
 MOVEM.L D0-D1, -(A7)   ; modifying routines    
 LSL.W  #6, D0          
 ADD.W  D1, D0          ; D0=Y, D1=X
 ADD.W  D0, D0
 ADD.W  (PTADDR), D0
 MOVE.W D0, D1
 AND.W  #$3FFF, D0
 OR.W   #$4000, D0
 SWAP   D0
 ROL.W  #2, D1
 AND.W  #3, D1
 MOVE.W D1, D0
 MOVE.L D0, (CPORT)
 MOVEM.L (A7)+, D0-D1
 RTS
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

RedAngel
Interested
Posts: 14
Joined: Wed Feb 07, 2007 7:29 pm

Post by RedAngel » Mon Sep 03, 2007 9:03 am

Thanks for the code but I guess I need to learn more to understand it :lol: .

User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Mon Sep 03, 2007 12:24 pm

It's not that bad, just do this :

CPORT EQU $C00000 ; these maybe the other way, don't remember
DPORT EQU $C00004
BMPX EQU $FF0000 ; use whatever addresses you want, needs to be in RAM
BMPY EQU $FF0004
PTADDR EQU $FF008

MOVE.W #$E000, (PTADDR)
LEA ThisIsThelineLableOfTheBitmapImage, A0
MOVEQ #0, D4 ; Tile index in VRAM where the BMP gets loaded
JSR LoadBMP
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

dtr138
Newbie
Posts: 2
Joined: Sat Jan 19, 2008 8:30 pm

Post by dtr138 » Sat Jan 19, 2008 8:34 pm

:( Is there a way to do this in BasiEgaXorz v1.00?
I tried doing this:

Code: Select all

 asm
(that huge snippet of code)
 end asm
 asm
CPORT EQU $C00000 
DPORT EQU $C00004 
BMPX EQU $FF002F
BMPY EQU $FF0034 
PTADDR EQU $FF008

 MOVE.W #$E000, (PTADDR) 
 LEA (__LABEL_bmp), A0 
 MOVEQ #0, D4
 JSR LoadBMP
 end asm
bmp: datafile myfile.bmp, BIN
but it didn't seem to work :?, any suggestions? 8)

User avatar
TmEE co.(TM)
Very interested
Posts: 2357
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sat Jan 19, 2008 8:57 pm

The reason this doesn't work is because of the addresses used of these "variables" :

BMPX EQU $FF0000 ; use whatever addresses you want, needs to be in RAM
BMPY EQU $FF0004
PTADDR EQU $FF008

These addresses are used by BEX itself... I can't really help more because BEX doesn't work well on my PC and I use ASM to do MD stuff anyway.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

dtr138
Newbie
Posts: 2
Joined: Sat Jan 19, 2008 8:30 pm

Post by dtr138 » Sun Jan 20, 2008 2:54 am

OK, thanks.
I just found out that the first available RAM addresses in BEX are FF002E (I think.... :roll:), so I'll try that. :D

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest