Recent Posts

Pages: [1] 2 3 4 5 6 7 8 ... 10
1
Yabasic / Letter Colour Assign
« Last post by bikemadness on July 08, 2018 »
Just something I've wanted to achieve.
An idea I wanted to apply to another program here.

up/down D-Pad to scroll. Surprise on left D-Pad

Code: [Select]
restore wishlist
read list
dim wish\$(list)
for a=1 to list
read wish\$(a)
next a

restore highlight
read cols
dim letters\$(cols)
dim R(cols)
dim G(cols)
dim B(cols)
for c=1 to cols
read letters\$(c)
read R(c)
read G(c)
read B(c)
next c

sel=1

open window 640,512
repeat
setdispbuf vm
vm=1-vm
setdrawbuf vm
clear window
letter=0
row=0
c=peek("port1")

if and(c,16)>0 scroll=scroll+15
if and(c,64)>0 scroll=scroll-15
if scroll>0 scroll=0

if and(c,128)<>0 left=1
if left=1 L=L+1
if L>2 L=2
if L=2 left=0
if and(c,128)=0 L=0

if left=1 sel=sel-1
if sel<1 sel=3

for a=1 to list
space=260/len(wish\$(a))
if instr(wish\$(a),"*",0)=0 then
row=row+1
for b=1 to len(wish\$(a))
for c=1 to cols
if mid\$(wish\$(a),b,1)=letters\$(c) then
letter=letter+1
setrgb 1,R(c),G(c),B(c)
endif
next c
if sel=1 text b*10+10,row*15+scroll,mid\$(wish\$(a),b,1)
if sel=2 text b*10-(len(wish\$(a))*10)+260,row*15+scroll,mid\$(wish\$(a),b,1)
if sel=3 text b*space,row*15+scroll,mid\$(wish\$(a),b,1)
next b
endif
next a

setrgb 1,256,256,256

text 10,(row+1)*15+scroll,"The "+str\$(row)+" listed are the ones I"
text 10,(row+2)*15+scroll,"have of the "+str\$(maxnum)+" in my wishlist"
text 10,(row+3)*15+scroll,str\$(letter)

until (1=0)

label wishlist
data 94
data "A QUIET PLACE"
data "*ACTS OF VIOLENCE"
data "AMERICAN PASTORAL"
data "ATLANTIC RIM RESURRECTION"
data "AVENGERS INFINITY WAR"
data "*BALLAD OF LEFTY BROWN. THE"
data "*BEAST OF BURDEN"
data "*BLACK PANTHER"
data "*BRAVEN"
data "*BREATHE"
data "BROKEN"
data "*BUTTERFLIES ARE FREE"
data "BUTTERFLY TREE"
data "CALL ME BY YOUR NAME"
data "CHAOS"
data "CHAPPAQUIDDICK"
data "CIRCLE OF TWO"
data "CITY OF GHOSTS"
data "COCAINE GODMOTHER"
data "COLD MOON"
data "COMMANDO"
data "*COMMUTOR. THE"
data "DEVIL IN A BLUE DRESS"
data "*DOCTOR DETROIT"
data "ENDLESS. THE"
data "EVERY DAY"
data "EXCEPTION. THE"
data "*FORGOTTEN. THE"
data "FUNHOUSE. THE"
data "GAME NIGHT"
data "GARAGE SALE MYSTERY"
data "GHOSTHOUSE"
data "GORGEOUS"
data "GRAVE OF THE FIREFLIES"
data "GUARDIAN. THE"
data "GUERNSEY. THE"
data "*GUN SHY"
data "HANGMAN"
data "HERO. THE"
data "HOWARDS END"
data "HUMANITY BUREAU. THE"
data "*HUNTERS PRAYER"
data "I KILL GIANTS"
data "*INSIDIOUS THE LAST KEY"
data "JOURNEY. THE"
data "KNIGHTS OF THE DAMNED"
data "LADY BIRD"
data "LAST FLAG FLYING"
data "LITTLE VAMPIRE. THE"
data "LONDON"
data "*LOOKING GLASS"
data "MARY AND THE WITCHS FLOWER"
data "MARY MAGDALENE"
data "MEAN MACHINE"
data "MECHANIC RESURRECTION"
data "MENASHE"
data "MERCY. THE"
data "MOLLYS GAME"
data "MOM AND DAD"
data "*MONEY TRAIN"
data "*MONSTER FAMILY"
data "MOUNTAIN"
data "MY LIFE WITHOUT ME"
data "*NINE"
data "PACIFIC RIM UPRISING"
data "PETER RABBIT"
data "*PHANTOM THREAD"
data "*PRESSURE"
data "PROUD MARY"
data "RAISING CAIN"
data "RAMPAGE"
data "READY PLAYER ONE"
data "REANIMATOR TRILOGY"
data "RECALL. THE"
data "*RED SPARROW"
data "RENEGADES"
data "RETURN TO MONTAUK"
data "REVOLVER"
data "RUROUNI KENSHIN"
data "RWBY"
data "SAM I BLOOD"
data "SECRET WINDOW"
data "SILENT RUNNING"
data "SINGULARITY"
data "SNOWWHITE A TALE OF TERROR"
data "STOP MAKING SENSE"
data "STRANGERS PREY AT NIGHT. THE"
data "SUICIDE SQUAD HELL TO PAY"
data "TEACHER. THE"
data "TOP GUN"
data "TURN IT UP"
data "TWELVE STRONG"
data "VIEW FROM THE TOP"
data "WEST AND THE RUTHLESS. THE"
data "WILD CARD"
data "WINCHESTER"

label highlight
data 26
data "A",255,125,5
data "B",50,150,50
data "C",175,75,145
data "D",95,30,210
data "E",255,255,5
data "F",150,175,185
data "G",210,115,30
data "H",180,240,165
data "I",255,5,5
data "J",250,70,10
data "K",195,40,10
data "L",100,75,30
data "M",180,180,180
data "N",85,170,225
data "O",5,255,5
data "P",165,105,105
data "Q",230,230,130
data "R",255,200,200
data "S",255,5,255
data "T",80,80,205
data "U",5,5,255
data "V",200,150,35
data "W",240,15,70
data "X",15,15,90
data "Y",65,140,250
data "Z",45,160,85

Have A Yahappy Day.
2
ASM / Re: PNG library suited for tiny intros on masm?
« Last post by Siekmanski on July 02, 2018 »
Hi Vil,

No need for bloated 3th party image libraries.
You can use GDIplus for that with a few lines of code.
It can load bmp, gif, jpeg, png, tiff and ico files from disk ( or from memory or from resource section ) and decompress it to memory as uncompressed raw ARGB data.

Here is an example to load a bitmap image from disk in Masm. ( and it's very very small.  )

Code: [Select]
include     \masm32\include\gdiplus.inc
includelib  \masm32\lib\gdiplus.lib

.const

; GDI+ info
ImageLockModeRead               equ 1
PixelFormat32bppARGB            equ 26200Ah

GdiplusStartupInput struct
GdiplusVersion              dd ?
DebugEventCallback          dd ?
SuppressBackgroundThread    dd ?
SuppressExternalCodecs      dd ?
GdiplusStartupInput ends

BitmapData struct
dwWidth                     dd ?
dwHeight                    dd ?
Stride                      dd ?
PixelFormat                 dd ?
Scan0                       dd ?
Reserved                    dd ?
BitmapData ends

GdiplusInput   GdiplusStartupInput <1,NULL,FALSE,FALSE>

.data?
; GDI+ data
align 4
pImage              dd ?
ReturnMessage       dd ?
GdiplusToken        dd ?
GDIplusBitmapData   BitmapData <?>
FilenameW           dw MAX_PATH dup (?)
ARGB_raw_buffer     dd 640 * 480 dup (?) ; memory to hold a raw 32bit bitmap of 640*480

.data

NicePicture         db "NicePicture.png",0

.code

align 4
GDIp_LoadBitmap proc uses ebx esi edi ImageName:DWORD,pBitmap:DWORD

mov      ReturnMessage,FALSE

invoke  GdiplusStartup,offset GdiplusToken,offset GdiplusInput,NULL
test    eax,eax
jnz      Exit_LoadBitmap

invoke  MultiByteToWideChar,CP_ACP,0,ImageName,-1,offset FilenameW,MAX_PATH-1
invoke  GdipCreateBitmapFromFile,offset FilenameW,addr pImage
test    eax,eax
jnz      ShutdownGDIplus

invoke  GdipBitmapLockBits,pImage,NULL,ImageLockModeRead,PixelFormat32bppARGB,offset GDIplusBitmapData
test    eax,eax
jnz      Close_Image

mov      esi,GDIplusBitmapData.Scan0     ; pointer to the bitmap data
mov      edi,offset ARGB_raw_buffer      ; pointer to the output bitmap data

mov      ecx,GDIplusBitmapData.dwHeight
Height_lp:
mov      edx,GDIplusBitmapData.dwWidth
xor      ebx,ebx
Width_lp:
mov      eax,dword ptr [esi+ebx]
mov      dword ptr [edi],eax
add         edi,4
add      ebx,4
dec      edx
jnz      Width_lp
add      esi,GDIplusBitmapData.Stride
dec      ecx
jnz      Height_lp

mov      ReturnMessage,TRUE

invoke  GdipBitmapUnlockBits,pImage,offset GDIplusBitmapData

Close_Image:
invoke  GdipDisposeImage,pImage
ShutdownGDIplus:
invoke  GdiplusShutdown,GdiplusToken
Exit_LoadBitmap:
mov      eax,ReturnMessage
ret
GDIp_LoadBitmap endp

; load bmp, gif, jpeg, png, tiff and ico files from disk and decompress to memory as uncompressed raw ARGB data.

invoke      GDIp_LoadBitmap,offset NicePicture,offset ARGB_raw_buffer
3
ASM / PNG library suited for tiny intros on masm?
« Last post by ViL on July 02, 2018 »
Hii!

i've stumbled on PNGlib like it's the only png decoder for masm, it is the only one out there? this is the site of PNGlib
http://www.madwizard.org/programming/projects/pnglib

while it's considerably small, uPNG on C output is even smaller, counting kb; but some pairs of kb makes the difference on tiny intros

may i ask if anyone knows another png decoder for masm?

any idea is very welcome! x3
4
General coding questions / Re: why colored opengl quads behaves differently in virtual machines?
« Last post by Siekmanski on July 01, 2018 »
About the gouraud shade colors in quads on virtual machines, I have no idea.
5
General coding questions / Re: why colored opengl quads behaves differently in virtual machines?
« Last post by ViL on July 01, 2018 »
hii, Siekmanski! your example is awesome! x3 and Hitchkikr one is very useful too!, thanks a lot for sharing them!

i'm already happy about having opened this thread lol through i'm still very puzzled about not having found anyone ever explaining nor even talking about what happens to gouraud shade colors in quads on virtual machines, any idea is very appreciated too! x3
6
General coding questions / Re: why colored opengl quads behaves differently in virtual machines?
« Last post by Siekmanski on June 30, 2018 »
Hi ViL,

A while ago I wrote an example for my little nephew.
He wanted to experiment with OpenGL and Masm.
Wrote some basic routine in one program.
Switching 2D and 3D mode, rotated cube with textures ( transparent color can be set, jpg gif bmp can be loaded from disk and resource section )
Background picture, transparent Bitmap font and a simple line draw function.
Some lables are in Dutch.....

Franck Charlet "Hitchhikr" wrote a lot of very cool OpenGL examples in Masm. http://perso.orange.fr/franck.charlet/Ogl_Asm.zip
7
General coding questions / why colored opengl quads behaves differently in virtual machines?
« Last post by ViL on June 30, 2018 »
i was testing quads using multiple colors (gouraud-shade) and for some reason virtual machines either inverts the quad colors or vertex order

here's a screenshot
https://i.imgur.com/tH2BCZI.png

i did a test using the same exe in my host and guest virtual machine, at the left of their screen they are all three triangles, both quads at the right

also enumerated the vertex order in which they are drawn in the image, you can notice the quads color or vertex are inverted on the virtual machine

i tested in VMware and a friend also tested on VirtualBox, the result is the same on both, may i ask why this happens?

attached the exe and source, the assembly source is here if that's better
https://pastebin.com/raw/4HFziKWv

thanks beforehand!
8
General chat / Re: DBF Challenge theme
« Last post by Yaloopy on June 30, 2018 »
Really like the ecosystem theme
9
ASM / Now you can follow NeHe's tutorials in Masm! (gl.def, glu.def, include.def here)
« Last post by ViL on June 29, 2018 »
While looking at Nehe's tutorial for opengl i noticed that they had a masm32 conversion for these examples, the tutorials start here:
http://nehe.gamedev.net/tutorial/lessons_01__05/22004/

then quickly realized the links were offline, but fortunately someone made a backup of most examples on github, including masm-converted ones, you can download them from here:
https://github.com/gamedev-net/nehe-opengl/

they used some definitions files that weren't included, luckily i found these .def files in the sources of a Northern Dragons' demogroup 4k intro named Trees, it was the only place to get them so i spread them here so you can compile and follow the great NeHe's tutorials!

gl.def
https://pastebin.com/raw/tq3TJVpf

glu.def
https://pastebin.com/raw/KwM8EjcT

please note that while these .def files are fairly complete, they don't have some opengl definitions; luckily the Trees' intro source also included the missing ones in an extra .def that i use too, here it is:

include.def
https://pastebin.com/raw/NTh58nXp

i made a example in masm using these .def too, the exe is 4kb unpacked but it features:
-screen scaling proportionally
-easy to customize resolutions
-fullscreen option that keeps the scaling ratio (set fullscreen to 1 in the .data group of the source)
-a colorful quad that takes the whole screen
-fairly minimal source to have a working pe-exe with opengl

screenshot
https://i.imgur.com/iIcEUNm.gif
edit: for some reason virtual machines inverts either quads color or vertices as unintendedly seen on the screenshot, a good workaround is to use two triangles instead of a quad, more information can be found here: http://www.dbfinteractive.com/forum/index.php?topic=6773.msg84335

source
https://pastebin.com/raw/Kns0FqBQ

note that including .def files doesn't grow your exe file!

i hope the template is useful for anyone!
10
Purebasic / Re: Beast Tribute
« Last post by aNdy on June 29, 2018 »
Many thanks for the kind comments!  Very much appreciated and boosts the desire to progress and improve my PureBasic coding.

Coming soon (hopefully), a simple little puzzle game called 'Blok Copy' which is a conversion of the game that has been released across different formats by Cosine.
Pages: [1] 2 3 4 5 6 7 8 ... 10