News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

New Member

Started by TheSpider, December 10, 2018, 11:30:19 PM

Previous topic - Next topic

TheSpider

Hello everyone,

First of all I have been lurking here for a few months and love the forum great resource for learning Assembly so thank you for everyone!

Let me shortly introduce myself.
I started with learning Python about two years ago and after one and a half years I realized I wanted to learn C/C++ and hopefully one day become a game engine programmer so I decided to
watch the Handmade Hero series. I loved the concept of more low level programming and also just generally the knowledge you get about how everything really works in the CPU, in Python everything is so abstracted away from you. I realized after a while that it would be worth to also learn Assembly so I have been skimming over some books and watched some youtube videos and got started to write some very basic stuff and followed a few tutorials from Iczelion's Win32 Assembly.

My first goal would be to write some simple game like Pong in kind of a Handmade Hero style.
First I wanted to be able to blit my own bmp to the screen and this is where I kind of got stuck.
I allocated memory for my bitmap with VirtualAlloc and then tried to use StretchDIBits to display it to the screen.
My problem is that I do not really understand how I can index into different parts of my memory which Windows gave me.
What I mean is in C I could easily do this (example below) what would be the equivalent in Assembly ?
*(char *)MyMemory + 25 = 0xff;
Also it seems the my StretchDIBits  call does not work, although I checked the LastError but Windows gave no errors.

I hope this was somewhat understandable...
I attached what I currently have written.
Any feedback is greatly appreciated!

Cheers  :t

felipe


felipe

i think one problem is that you are not returning a 0 value after processing some messages... :idea:

jj2007

Use GetDIBits to access the memory. It's the only reasonable way to do so. Use the forum search for assembler examples.

Siekmanski

Welcome to the Forum.  :t
Creative coders use backward thinking techniques as a strategy.

TimoVJL

Quote from: TheSpider on December 10, 2018, 11:30:19 PM
What I mean is in C I could easily do this (example below) what would be the equivalent in Assembly ?
*(char *)MyMemory + 25 = 0xff;
A bit confusing C code, do you mean ?*(unsigned char *)(MyMemory + 25) = 0xff;
May the source be with you

TheSpider

Thanks for the suggestions.

Turns out I was passing the wrong register to VirtualAlloc after the mul op.
So I did not get back the correct amount of memory.
Forgot that mul stores the result in rax  ::)

So now it works!

Cheers.