|
You can use DOS alone if you only want to learn x86 asm using MASM...
"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization." ― Gerald Weinberg
|
|
|
|
|
The first few applications I ever wrote for PCs were in 8086 assembler. But when I moved on to C and its derivatives I sort of forgot it all. I have recently been writing some simple assembler applications and discovering how easy it is to access the Windows API from it. I found a free download of https://www.amazon.co.uk/Modern-X86-Assembly-Language-Programming/dp/1484240626[^] but cannot find where I got it from now. ![Sigh | :sigh:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_sigh.gif)
|
|
|
|
|
Sounds like you are having an interesting, and learning, adventure. Keep in mind that back in the day (can you say the '60's?) resources were rather scarce. The language choice, on some of the systems I worked on, was Assembler or Fortran! Base system had 4K of 16 bit, core storage memory, either 2 or 4 microsecond. Paging to and from (small) disk was painful. The level below assembler was machine language input via bit switches.
Real time systems required assembler. 4 levels of interrupts and 15 levels of cycle steal. Creating re-entrant subroutines was challenging. One hasn't lived until assembling and linking a program written on paper tape, on a 4K system.
>64
It’s weird being the same age as old people. Live every day like it is your last; one day, it will be.
|
|
|
|
|
|
I'm programming a 2D RPG game that uses an array of derived class instance pointers. For clarity I provide a code example in C++. I would like to sort the elements of the entities array based on the worldY value of each element.
main.cpp:
<pre lang="C++">
/*
* result:
* player
* object
* object
* npc
* npc
* 2 npc y: 30
* 1 npc y: 6
* 1 object y: 20
* 2 object y: 10
* player y: 0
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include "Entity.h"
#include "Npc.h"
#include "Player.h"
#include "Object.h"
int main()
{
Player* player = new Player();
std::vector<Entity*> objs;
std::vector<Entity*> npcs;
std::vector<Entity*> entities;
Entity* tmp = new OBJ_o();
objs.push_back(tmp);
objs.at(0)->worldY = 20;
objs.at(0)->ID = "1";
tmp = new OBJ_o();
objs.push_back(tmp);
objs.at(1)->worldY = 10;
objs.at(1)->ID = "2";
tmp = new NPC();
npcs.push_back(tmp);
npcs.at(0)->worldY = 6;
npcs.at(0)->ID = "1";
tmp = new NPC();
npcs.push_back(tmp);
npcs.at(1)->worldY = 30;
npcs.at(1)->ID = "2";
//--------------- update -------------------
player->update();
for (auto iter_objs = objs.begin(); iter_objs != objs.end(); ++iter_objs)
{
(*iter_objs)->update();
}
for (auto iter_npcs = npcs.begin(); iter_npcs != npcs.end(); ++iter_npcs)
{
(*iter_npcs)->update();
}
//-------------- entities --------------------
entities.push_back(player);
for (int i = 0; i < objs.size(); i++)
{
if (!objs.at(i)->name.empty())
{
entities.push_back(objs.at(i));
}
}
for (int i = 0; i < npcs.size(); i++)
{
if (!npcs.at(i)->name.empty())
{
entities.push_back(npcs.at(i));
}
}
// sort entities
std::sort(entities.begin(), entities.end());
//---------------- draw entities ------------------
for (auto iter = entities.begin(); iter != entities.end(); ++iter)
{
std::cout << (*iter)->ID << " ";
(*iter)->draw();
}
return 0;
}
Entity.h
#pragma once
#include <iostream>
class Entity
{
public:
int worldY = 0;
std::string name;
std::string ID;
public:
virtual void update() { std::cout << "base" << std::endl; }
virtual void draw() { std::cout << "base y: -\n"; }
bool operator<(const Entity& obj) const
{
return worldY < obj.worldY;
}
};
Npc.h
#pragma once
#include "Entity.h"
class NPC : public Entity
{
public:
NPC();
void update() override;
void draw() override;
};
Npc.cpp
#include "Npc.h"
#include <iostream>
NPC::NPC() { name = "npc"; }
void NPC::update() { std::cout << name << std::endl; }
void NPC::draw() { std::cout << "npc y: " << worldY << std::endl; }
Player.h
#pragma once
#include "Entity.h"
class Player : public Entity
{
public:
Player();
void update() override;
void draw() override;
};
Player.cpp
#include "Player.h"
#include <iostream>
Player::Player() { name = "player"; }
void Player::update() { std::cout << name << std::endl; }
void Player::draw() { std::cout << "player y: " << worldY << std::endl; }
Object.h
#pragma once
#include "Entity.h"
class OBJ_o : public Entity
{
public:
OBJ_o();
void update() override;
void draw() override;
};
Object.cpp
#include "Object.h"
#include <iostream>
OBJ_o::OBJ_o() { name = "object"; }
void OBJ_o::update() { std::cout << name << std::endl; }
void OBJ_o::draw() { std::cout << "object y: " << worldY << std::endl; }
(see result put as comment at the beginning of Main.cpp).
How should I do an increasing order of y (worldY) ?
Using:
std::sort(entities.begin(), entities.end());
I don't get the desired result:
player
object
object
npc
npc
player y: 0
1 npc y: 6
2 object y: 10
1 object y: 20
2 npc y: 30
|
|
|
|
|
Please read the red text a little bit above your post. It talks about how this is not the appropriate place for a post of this nature.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
As many people are about to tell you. There are no programming questions in the lounge. You should probably post this in the Quick Answers instead.
|
|
|
|
|
|
Working on a remote server for a customer - has VS 2015 installed. Microsoft has decided through it's "magic" that I don't have a license anymore. Fine, I'll update you to community edition. Nope, have to uninstall first. Okayyyy, go to the Apps and Features for VS 2015 - no uninstall option. I have to "modify" the installation. Okayyyy... it's been going for 4 hours now.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Wouldn't it be the customer who needs the license, since it's installed on their machine?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
technically maybe? I'm a small company so on occasion I will install CE to complete some debug work. Then I remove it. Today's phrase is "if I Can remove it."
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
The risk here is that you end up partially removing the older version, and failing to install the new one. Then you have two problems on your hands - getting the original reinstalled, and solving its license problem.
|
|
|
|
|
Hey! No spoilers in the lounge!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
well sure, but I *know* it's a vm, SO, YOU GO BACK TO THE ORIGINAL. Damn new keyboard... sorry about that
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
I didn't bring it up, but that's exactly what I was thinking. Checkpoint, tinker with it all you need, if it works, re-merge to make it the latest, otherwise roll back.
|
|
|
|
|
A colleague once installed the wrong version of VS on a fresh Windows version. Once he saw the uninstall (lack of) progress indicator he did the smart thing and wiped the disk and reinstalled Windows.
|
|
|
|
|
|
Back when I was a teenager, I would mentor other people on how to code. I still do some of that online, but it's not the same as living with your buddy and coding together. That kind of collaboration spurs inspiration and can make both parties better coders. It did in my case.
Contributing to a very active project, especially one that gets as much play as LVGL is similarly satisfying despite being all online. GitHub is nice in that it's an all in one collaboration tool if you use it properly and it kind of removes the typical barriers one might face trying to code together. Not quite the same as AnyDesk and a phone, or an in person collab, but close.
I kinda wish my projects got more play. My graphics library is somewhat popular, but I have only one contributor, and he works on the website exclusively.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Quote: I kinda wish my projects got more play. My graphics library is somewhat popular, but I have only one contributor, and he works on the website exclusively.
I agree with the satisfying aspect you mention, having written several Arduino libraries, I also recognize the contributor effect. The number of contributors is not high, still I find them very valuable as they add functionality. Most important imho are the people who take the time to report bugs or unexpected effects that I have missed (or skipped). Their fixes and insights are very much appreciated as they save a lot of time in investigating.
In short, people who open issues are imho also contributors.
How do you look at them?
|
|
|
|
|
That's a good point. I hadn't thought of it that way. At one point I had a guy furiously working with my graphics lib and submitting issues, and it was extremely helpful, not only because of the bug finding, but because it gave me a good idea of how it was being used.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
modified 8hrs 20mins ago.
|
|
|
|
|
I haven’t contributed code to open-source projects, but I try to alway donate or pay for free or shareware apps. I’ll also send ‘notes’ on bugs or usability issues if the developer has made it easy to send comments.
And, yes, I’m the guy that paid for my copy of WinRAR.
Time is the differentiation of eternity devised by man to measure the passage of human events.
- Manly P. Hall
Mark
Just another cog in the wheel
|
|
|
|
|
I find it really satisfying to use Open Source projects ![Smile | :)](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Wordle 1,082 4/6
⬜⬜🟨⬜⬜
⬜🟨🟨🟨🟨
🟨🟩🟨🟩🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,082 2/6*
🟨🟩🟨⬜⬜
🟩🟩🟩🟩🟩
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Wordle 1,082 4/6
⬜⬜🟨⬜⬜
🟨🟩🟨⬜🟩
🟨🟩🟩🟨🟩
🟩🟩🟩🟩🟩
|
|
|
|