#code-talk
2 messages ยท Page 13 of 1
the thing is, for the exception of a PC, most things have firmware that can't be changed without literally soldering wires to the side of the chip and programming it with a special programmer device connected to a computer
well like how computers used to be specifically designed machines, they became more versatile
i kind of expect maybe the day of firmware may be coming to a close
or dimming
I forgot to add about malloc, the reason I don't need to allocate memory on a microcontroller is basically because malloc is really an OS thing, it's about reserving memory so one program can't write over the memory of another program
on an embedded device you dont need heap memory at all, because you are not forced to share memory
you can just use the stack
but if you wanted to use a heap allocation youd need to system call the OS
when you make a program for a microcontroller, if it is programmed into the firmware, then that program /is/ the operating system
yah
if it is programmed in arduino for example, arduino has a bootloader firmware which is separate from your sketch files
so really when you use arduino, the arduino bootloader is your OS in a way, and your sketch is just a program
when you instead use atmel studio or mplab instead you are not making a bootloader, you are making the whole firmware
well, does arduino have a real time oS?
because if so, then sure; thats what i would prefer, frankly
however there are libraries you can use which have custom bootloaders
i dont personally see that as advantageous. its like touting the merits of a one-time use rocket booster
there's just so much you can use but it is more efficient to have your entire program run with nothing between your program and the CPU
i would prefer not to deal with all the boiler plate and i would like to program logic
for example, arduino can't do anything for ATtiny10 because it does not have enough memory
you embedded guys are nuts for this stuff
i cant understand the interest
its like you enjoy it because its difficult, not for what it can do for you
this gives you an idea just how small the CPU is lol... last I checked it was about the size of a grain of dry rice, and really hard to solder wires to it even with a magnifying glass
the picture is also taken through the magnifying glass
the USB connector is there to compare the size
anyway what the program will do is save a couple dollars by replacing a bunch of digital logic gate chips with this, so it can be used to turn something on or off with push buttons, one button for starting (PINB0), one for stopping (PINB1) and then outputs are on PORTB2 and PORTB3, where PORTB2 would be high when the stop button is pressed or simply at the beginning of the program before the loop, it would be set high, and would switch off when start is pressed - similarly PORTB3 would be on when start is pressed and off when stop is pressed, so you kind of have the ability to output to something when something is stopped
and so this is where the book reading comes in
to set an IO pin to be an input or to be an output, basically this DDRB register is used to set 4xIO features to be inputs or outputs, where a 1 designates it as an output
so you can see on the highlighted line, it is setting the PINB0 part of DDRB to zero, though by default it is zero, I just like to be on the safe side and make sure it is zero
This chat is big brain
4 hours of big brain
so I could send bits of course, I could instead write DDRB = b0000 to set pinb0 to be an input instead of output, but this would also make all 4 IO to be all inputs, even if I wanted just to modify the value of only one bit
I should say the file designates all IO for the ATtiny10 as PB0, PB1,PB2 and PB3 for pins 1, 3, 4, and 6 respectively, but the compiler does not have those definitions, apparently deprecated or something so you have to write it as either P<IN/ORT>B<number>
since i know normies are reading now, check out the difference between normal resizing and ai-enhanced upscaling - waifu2x
but if you took a proper programming course you may have heard of LSB and MSB, it turns out this is MSB
so to set PB2 and PB3 to output you can just do DDRB = b1100; and omit the 4 lines of code I wrote
finally, 4k grom will be a reality.

I just have a different style but the compiler packs it into bits anyway
I was trying to explain how it works so you have an idea what the code was doing
I have to admit, I didn't take a computer course, I took instrumentation and electrical engineering, I always knew software development was going to be flooded by the masses
the masses are just given the easy work and they think they know what they are doing until their projects start dying to bugs they can't fix
people want very complicated things
@severe jewel i've done it. i've achieved grom8k. its amazing how it looks the same as a thumbnail
holy hell thats a big image

discord has trouble handling standard file sizes in 2020
that's going up on the wall
apparently also has trouble with bitrates in streaming in 2020 as well
it's like an optical illusion - the more you zoom out the more familiar the picture looks, the more you zoom in the more he becomes
isn't that the painting of jesus that someone mutilated after it got wrecked?
I mean I like the meme but on a more serious note it was a really terrible tragedy
its sad. but nobody died. and we still have pictures of how it used to be, right? and now its also fun
i would have nothing else to compare grom8k to
i decided to leave the art filter on when i upscaled that
before and after for lazy normies
I mean these are the kind of videos that excite me at midnight https://www.youtube.com/watch?v=yOyaJXpAYZQ
In this video, I compare a simple C program with the compiled machine code of that program.
Support me on Patreon: https://www.patreon.com/beneater
yea boomer that was absolutely nuts I am surprised they could never find someone who could copy the original one
and you wonder why everything is going offshore
not really. ive seen americans' grasp of math
the problem is, and I include my own country, we all have lacking standards
they happily scoff at one another "who needs algebra, seriously?"
the quality of what we can do is really poor and increasingly becoming worse, but we need to push education a lot more
its just expensive to get that work in the US
by that I mean start forcing grads to be good at what they do
if they can't pass tough tests, fail them instead of lowering the standards
you know its like a 120,000 dollar a year job, very intense labor competition
if people really want to pass they will do the work or they can simply fail in my opinion
in my college course most of the class failed fluid mechanics so the dean downgraded it to high school physics
all because the majority rules too much
not everybody is prepared to do that much work at that specific moment in their life
I would be perfectly happy if the vast majority failed
its better off if people are exposed to the ideas and know they are there to come reference later
the thing is we need much higher education standards if we want to compete with china
most of what I know and do is basically self taught
I would say 100% of what I did in college for engineering was useful, but it just was not enough
most people complained the whole way about the course difficulty but I found it too easy
it sure helps if youre passionate about the subject
like we learned about bypass filters but even the instructor couldn't explain what they were needed for, it wasn't until I started experimenting on my own that I found out just how important they are
literally most of the time the people teaching the stuff don't really understand it, their job is just to cover the content of what is listed in the course outline
the motivation of the college as a whole is masses of students to make profit, even in publicly funded college systems as in ours
the instructor first said at the beginning of the course, transistors were outdated so he wouldn't cover them - I pressed for it and we got it, but I noticed he didn't really understand them which is probably why he didnt want to cover them - now I have bags of 100 each of them because they are one of the most used item for switching stuff on/off without burning out low current terminals or for audio or making sine wave, etc
I basically had to do a full blown electronics course online after I passed his course, and I got far more involved
but this is why I also like the 1970's books on computers because a computer today is too complex to understand entirely, but when you go through the history, build your own 8 bit computer and program it, then move on to more advanced computer tech from the late 80s and so on, you start to see how the original 1970's concepts are still in use in every modern computer
guess I should take note of that
yes, how effective has the baloney marketing been at convincing us that tape reels are outdated? the national archives still use them - in fact, IBM makes new standards to LTO tape drives even now
aren't most servers on magnetic tape?
data is still largely held on magnetic media
well tape is hard to access dynamically so it is mostly archival
floppy disks were a way to make dynamic magnetic storage that could be randomly accessed because it's literally a spinning disc like a hard drive
I would be interested in inventing perhaps a high speed tape that could be accessed randomly, but to be honest that would still be slow as heck
I mean, isn't most research just looking at what can be done, even if it's not practical?
yes it is bearded men with soldering irons inventing most of what you see, but they put a smiling beach girl on the package to sell it
I mean, when you think of the word speed, to you does it mean just latency, bitrate or a mix of both?
probably a mix
with a high speed tape reel you could have high bitrate but also high latency
smart defragmentation could be done at random times
I'd got nearly no insight to see how hardware like that could come in handy but I'm willing to bet that there is some (relatively) obscure field out there that might need something like that
well you know the very first implementation of magnetic storage was a metal band that was dangerous because it could snap and hurt people badly, but even though flexible tape replaced it, guess what, that outdated idea of using metal for storing magnetic data is not lost as it is used in flight recorders because it can't be burned
actually it was used for audio not data
but now of course flight recorders use a steel wire instead of a metal band, but same concept
oh yeah, know someone who works in aviation that told me some about it
so people keep thinking outdated is a thing, but we keep seeing outdated technologies suddenly becoming new
most of the stuff we use were laid down in concept years ago
all that makes a difference is perception of the masses
tapes use caching, so there is a lot of the file allocation table data stored on EEPROM that is built into a controller and of course some little bit of SRAM for streaming bits into buffer to make packets/reports to send to the computer... this is why new tapes are expensive
don't mind me, I'll digest this information for a bit
every tape is basically a mini computer just to handle the addressing of where file bits are located, how much PWM to send to the stepper motors to get to the address location, then you have to buffer the data and make a report which includes your vendor ID, USB page data, the packet header, packet of data, etc
well at least there are no motors on the tape so there is savings there
you could opt to use the old tape standard, instead of a cache and all this, it's just a simple thing of reserving the first length of tape for storing the allocation table and then the rest is data, but then you'd have to rewind the tape each time just to open 1 file
oh yeah, it is slow in that regard
yea the archives used to have the old standard at one point but even though it is cheaper to archive data like that, the problem is the allocation table limit
of course it is no coincidence that FAT in FAT32 stands for file allocation table
though even all the other formats are file allocation tables, just done differently
I'll come back when I get a grasp on this before I make retarded statements
if the bits don't make any sense and the compiler is eating itself you can always have a beer
hm, so I guess all types of data storage needs a directory
to be honest punch cards don't sound entirely like a bad idea, if you used a laser to burn marks into a paper you could use different burn temperatures to generate byte/multibyte codes instead of simple bit codes using different burn patterns
can it stay consistient enough to read that?
can reinvent the QR code using a totally new standard
well the only thing I can see something like that used in is for like a bar code thing
or maybe forensics
perhaps have printers burn a code on every paper they print to identify the printer that it came from
I mean they already do that with ink
ooh, would be good for archiving
I love how the first laser mouse worked, so there was a special mouse pad, if you lost the mouse pad it was very expensive to replace and the mouse needed that pad to operate
seems about right
it was made by Sun Microsystems
stuff seems specialized as hell
yeah there was a special grid pattern in the mouse pad and as you moved the mouse the photodiode would detect the x or y direction of movement on the grid
yeah that seems like someone making a laser mouse for the first time would make
laser mice moved to using a camera instead, and there is actually software now that you can use to take pictures with your mouse, albeit really low quality, but hilarious
that seems like something I missed in my age
I am surprised the tin foilers aren't still using ball mice
Ball mice work alright
just have to clean the rollers
yeah
when they get shiny they slip
I used to have a Ps2 one that I dug up that had a bit better ergonomics than my current one
the original ball mice with potentiometers I find are better than the newer ones that use rotary encoders
the thing is with potentiometers you can have a smaller area to move your mouse fully around the screen
they aren't infinite
interesting.
the only thing I can see the old stuff being useful for really is digital artists who might want to try something different for freehand drawing
eh, I'd rather stick with a ball mouse than a surface sensitive laser mouse
partly because I'm a lazy ass
so far my only useful coding projects were for an automatic door opener and another one for automatic realtime power switching in a surge protector
other stuff was mostly modular not really big projects but used for other projects
it is hilarious that I can use a bunch of small batteries to open a big heavy door, though it is slow and uses higher torque based on gearing
hey, what works works.
the only thing stopping me from doing better projects is anything that uses more than like 30-50 volts requires underwriter labs testing and certification
the other thing is RF modulation requires industry canada testing
or FCC for the US counterpart
I managed to fuck my installs and not even a reinstall fixes my problem
kek
just flat out deleting the folder fixes it
back to square one
The wonders of VS
The wonders of downloading a github nuget plugin in an attempt to get JSON to work
what plugin you using? and why isn't it newtonsoft.json?
because the guide I was following was using system.text.json specifically
VS is garbage imo, it takes a long time to load and then says my license expired
Atmel is free to use and has better compilers, doesn't crash or freeze all the time, and you can theoretically write windows programs in it
however its main function is programming Atmel microprocessors
I can probably bet on the fact foxhole devs use Atom instead
there is absolutely nothing good about VS once you start modifying the underlying code for a window the program will start giving you trouble
you know what's interesting is that VS 2004 had the same bug it has now
Microsoft literally does not care
your only option around the bug is simply create your windowed programs all as console apps and then implement the window features in code rather than in the visual IDE
to make things easier, you can use 2 separate solution files; one to generate the automatic code from the visual IDE, and one for your main solution and just copy paste the auto generated code over
I still use VS 2005 on a windows XP machine that does not connect to the internet, the only reason being that MS for some reason gave us all free unlimited licensed copies of 2005 edition long ago, but now you have to pay a subscription fee
What about community edition
I don't use cloud
I get that they want to force everyone to use public hard drives but most of us keep our tin foil at bay even if theoretically tin foil actually increases the likelihood that your head will conduct more electromagnetic waves
How do you do git commits then
I don't use github though the idea of openly sharing everything sounds great
there's a reason I am writing my own compiler and my own libraries 
Basically you create a private repo
Commit there when you do something
And if your hard drive dies you lost at most 2h of progress
yeah it's private so long as nobody knows how to inject sql commands and leak data from the servers
things like cloud/github/etc are really bad for any team that wants to create proprietary software or firmware
you can use SVN on an intranet
or CVS if you are old school
I don't use version control, because I don't want to keep my failed contraptions
I suppose so, but there is nothing wrong with SVN
Do you at least cover your code with tests
Anything to check regression after changes
most firmware development kits like atmel studio have built in simulators that simulate what will happen on the CPU before you upload the code
they can't simulate smoke though
I don't like community edition
and they can't simulate my computer suddenly rebooting when I short positive to ground through USB accidentally
gib Enterprise
Oh i see
Cause javascript is a bit different
it can run and never tell you that something is wrong
so you have to cover that shit with tests so that SOMETHING fails when there are errors introduced
and even then its not enough
one mystery I wonder is how VS handles makefiles, I could never find the options to set VS up for that, but other competing software has all of it built right in
but then again MS is a competitor to GNU free software foundation, so there is that reason probably
idk personally I like XC8, I don't use GNU C, but I do use gmake
you can use GNU C to make something proprietary as long as you use your own standard libraries, but on the flip note the problem with GNU C is that it's a community run open source project, and that means it is basically a jack of all trades but king at nothing
people still use gcc? thoguht everyones moving to llvm
I would say over 95% of the internet is full of programs compiled in gcc
you have to realize windows is a small world when it comes to server side stuff, on servers literally everything is written in C, and for those server side programs not written in C, it is almost always the excuse of "well C was too difficult" - yet entire GUIs and even full scale 3D video games have been made in it despite this claim
its time to get off your C is the best soapbox
the reason people often say their software is C++ even though it is truly C to the C99 standard is that the real low level C is ANSI C, which is not used so much anymore - most people consider what is effectively the new C standard to really be C++
i think most people accept llvm is a better compiler than gcc
nobody considers the new standard to be C++
if you are referring to .net, that is Microsoft based entirely
the thing is, languages are just a human readable input to a compiler - everything is essentially the work of the compiler
yes I can see that but even then it will unlikely surpass GNU C
i dont know why you keep lecturing me on how compilers and computers work as if i dont know
well from what you have been telling me, I assume you don't know, especially when you said we don't need to add null termination to strings anymore
I can tell you right now that statement is what triggered me, lol
here's the thing, ok, null termination has absolutely nothing to do with C, C++, C# or java or whatever, null termination is used by every CPU to understand where a character array ends
fake news
youve got to be kidding me
a string is literally just an address pointer, the rest is a character array in memory and the CPU keeps reading bits in sequence until it reaches a null character that ends the pointer
i know how strings work. your assumptions are just incorrect
you know why allocating is so important?
i know everything
of course
so let's say you have 4 bits of space in sequence before some other value is stored in memory, but you want to store 6 bits, well, a string pointer is going to point to the first address of those 6 bits you want to store - of course, if you choose to write those bits, you will write over top of another variable's addresses... so by allocating memory, you're telling the CPU to reserve 6 bits somewhere in sequence and then it returns you the first address in that 6 bit sequence for you to start writing the bits to
i know very well how memory management works, thanks
in C#, microsoft's compiler will automatically add 1 to any memory allocation to account for the null termination
i can tell you where you are incorrect if you want to know
you don't have to worry about null termination most of the time in C#, however you still need to know it exists because if you assume you know and you are wrong you will cause memory leaks
your first example is a stack memory allocation. that works the same in C as in C#, they both increment a stack pointer and decrement it when its done
when you are talking about references, you are referring to a heap allocation, so its nothing like your first example. you are comparing apples and oranges
a heap allocation in C uses malloc or similar system call
it is the same on every computer, even the same on a microcontroller as small as a piece of rice, every computer in existence uses null terminating characters to end strings
where did you read that?
its asciiz, the z means zero
no it is not 0
in the same way that C has no true or false, it has no null either
asciiz is a convention, it is not a requirement of cpus
if you write 0 it will translate to integer value of 48
and just as i explained how pascal has not been using strings terminated with 0 or null for 60 years, its clearly not a requirement of the processor
im talking about 0x0 not '0'
an integer value of 0 is null, that is correct
its not null, there is no null in C
but 0 in a string is 48
i know what you are trying to say but i dont know why youre bring it up. im not talking about the string value of 0
it should be clear im not talking about that
so are you saying this is no longer relevant? https://docs.microsoft.com/en-us/windows/win32/intl/using-null-terminated-strings
no im not saying that
ill put it this way, old x86 had an interrupt for printing strings. the terminating character on those strings was $
you know what TCHAR is for?
0 is just another convention that doesnt really get used in modern languages, even C abandons them for actual string implementations
TCHAR is a macro, so its like a official language feature
its just a 16 bit number i assume, a wide character
you are really missing the basics
maybe its 32 bits i dunno
bruh you are stuck in a tiny segment of C and you think you know C
This is ridiculous to talk about this was hashed out by much smarter people than us over 50 years ago
you're the first guy I have met who said that null termination is not used anymore
its not
its still used sometimes in C
but even in C people use string libraries now that dont use zero termination
it is used all the time in any kind of string
ok whatever
heck it is even used in arrays
i really dont care
so I have to admit, I don't program in unicode, so I looked up null termination in unicode just for you because I know C# is all nuts about unicode in order to support multi language development
I don't even use unicode, but even without using ASCII and using unicode tables instead, even in that scenario, Microsoft says you still need to use a null terminating character even in unicode
ANSI C and C at C99 standard neither use unicode, they are ascii-only but they can include unicode implementation through libraries and bit banging
this does not make sense
it was easy to use string libraries that support unicode in C before 1999
there is no string object in C, as you know
it all depends on which libraries you use
string libraries in C were limited to ascii, if you wanted unicode you had to use a whole different set of libraries
modern string libraries dont use zero termination because its slow
the old CPUs often have trouble because they have small address buses
they were all ascii based before the 90s
heck there is even a 5 bit character table that pre-dates ascii
typedef struct derps_string {
int length;
ushort * data;
}
thats how a modern string object would work
or even better, int * data
that is your 5 bit character table, how lovely, does not even have punctuation markings in it
well, paragraph symbol anyway and the other ones like that
data is a pointer to an address in your string example
when you grow up in an age where int changes size over the years, you realize nothing in C is nailed down, everything is just a convention
any time you use * you are pointing to an address location
when i was a kid, an int was 16 bits
that is entirely dependent on the platform
it's not a compiler thing, it's platform, as in the CPU architecture and whether 32 bit or 64 bit OS
to understand data types and how they work you first need to refer to your CPU's reference manual, in this case I copied this from Intel
a CPU does not know what a character is, all characters are stored as integer values, thus this is why char is often going to be smaller than integer because a char is a smaller number generally
a lot of what I work with is low level as you can imagine I literally just program microchips, that's as low level as you are going to get, so for me, efficiency is everything - if I am doing something inefficiently, I will run out of program memory or even volatile memory if I declare too many global variables for example
software developers don't have to worry much about it because personal computers have so much memory in them you can practically run the earth on your smartphone if all the systems in the world were programmed for pure efficiency
ive wired my own computer with jumpers and transistors
here is a great experiment for you; make a C hello world app and a C# hello world app, run each one and see how much CPU clock time and memory each one use
why
the C# version will use at least several megabytes of data in memory, even if it should only use less than 1k
i've got one. make a hello world program that works with utf8
youre just making up a test thats super obvious, we dont even need to test it
so you can admit C# is bloatware, at least that much we can agree on
these are tired arguments
if C was so perfect, why did people keep making thousands of new languages for the next 60 years
if C was not perfect, why is it still being used today? how come microchip isn't using C# by now?
so anything being used today is perfect?
I am surprised no one here corrected me when I stated that C was made by Brian Kernighan, though he did write the first manual on C, it was actually Dennis Ritchie
i got tired of correcting you, i asked where you got your facts
and i think his contributions to C++ were minor
but i think people who make very popular languages are not zealots to only their language
C was invented in 1970 on a computer that had flashing lights instead of a big monitor screen, ironically, it never became an obsolete language
when you read interviews with them, theyre clearly borrowing the best parts from all the things they admire
C# will eventually die off, it will be replaced and C will still be here
the only thing that kept java going really was android and oracle
I wanted to bury java in 1999 and never see it again
python is going to last quite a long time, though I don't use it
here I fixed the chart for you
the quadword can also be a regular double, or a long on 64-bit only
and this is why I say it is really nothing to do with compiler as it is how the CPU handles the data, that is why 32 bit and 64 bit have completely different ways of storing data types and why they are incompatible (however intel has backward compatibility to 32 bit but this is not always the case in every CPU manufacturer)
typical data size chart, it doesnt matter what compiler you use or what operating system you use, it is entirely platform dependent, though this chart does assume you are either using AMD or Intel, however, there are other CPU manufacturers that have different ways of storing data where this table would not be relevant
none of this makes me wrong
you just wrote on top of a chart... i said the compiler defines it, and then you confirm that by writing the compiler definitions on it
dword is not just another word for int. only because the compiler says so
frankly, thats not even true. a dword would be a uint
it can be either, right?
well I am trying to put together a way to explain this easier for you, because there is a reason why 64 bit data types often use the same byte count as 32 bit and it has to do with intel splitting the CPU registers in half on 64 bit to allow you to access the Exx registers even though the new 64 bit registers are all Rxx
AMD does the same thing, well, because intel uses AMD's original 64 bit architecture
you dont have to explain it, i know already
but im also telling you i know that the compiler defines what an "int" is
not intel or amd
so this is the big Intel Bible, if you preach Intel as a software developer, this is what Intel has said is what software developers should read... and... it is quite lengthy but you can zip through it sometimes https://software.intel.com/content/dam/develop/public/us/en/documents/325462-sdm-vol-1-2abcd-3abcd.pdf
to be honest most of what they write in there is only useful to an engineer designing a new motherboard (me in 10 years?!) or for someone making their own compiler (long project in the works on the backburner)
if all you do in your day is make websites, I think a lot of this is irrelevant to you anyway probably
RCX is of course, as you might have guessed, a 64 bit register where ECX is a 32-bit register, as I explained where Exx is 32-bit and Rxx is 64-bit, however they are really the same register; RCX is split in half, and one half is ECX
these two registers are where the CPU matches a null termination character to validate a string
who would have thought a CPU did math analog style? the universities won't teach you this, no, it's just hidden in the Intel Architecture bible...
and yes, before people start jumping on me over calling it analog, the only way, the only way to measure resistance is with analog and then you have to do analog to digital conversion again to get the digital signal - still, this is great knowing that Intel uses analog for math
I don't normally post memes.. like extremely rarely, but I feel this is extremely relevant
lol really?
the universities wont teach you this
they literally teach you this. its like a junior level class in cpu architecture
i started uni, but once i worked out how calculators did math and that cpu was just that to the crazy nth degree, i was like, im done, out.... and dropped out to try and change my life direction. it worked somewhat, but i ended up in self tought web programming instead....
It isn't that hard
You just write what you want and give it to someone who knows better
Ditch the calculator and do the math yourself
Lmao
when you make your code look like arduino IDE, but its actually overcomplicated C avr code to sequentially toggle 4 leds
#include <util/delay.h>
#define INPUT 1
#define LED_DDR DDRB
#define LED_PORT PORTB
#define LED_1 PB5
#define LED_2 PB4
#define LED_3 PB3
#define LED_4 PB2
void Toggle_LED(int Led, int state)
{
if(state == 1)LED_PORT &= ~(1<<Led);
if(state == 0)LED_PORT |= (1<<Led);
}
void Pin_mode(int pin, int pinmode)
{
DDRB |= (pinmode<<pin);
}
int main(void)
{
int LED_array[] = {LED_1, LED_2, LED_3, LED_4};
for(int x = 0; x < 4; x++)
{
Pin_mode(LED_array[x], INPUT);
Toggle_LED(LED_array[x], 1);
}
while(1)
{
for(int x = 0; x < 4; x++)
{
Toggle_LED(LED_array[x], 0);
_delay_ms(500);
Toggle_LED(LED_array[x], 1);
_delay_ms(500);
}
}
return 0;
}```
I still have to find a way to pass the data register for Pin_mode. so far my attempts havent worked
my whole C code ported to assembly, so no libraries were used for it and it works exactly the same
Rem, it's not the same as arduino because arduino uses a special bootloader to load sketches with, whereas if you program it in atmel studio, your code is instead made into hex directly and your program becomes the whole firmware
with arduino, you have to use ICSP to first burn firmware bootloader, then you can upload sketches simply with TTL logic using a USB serial to TTL converter and that uses entirely different pins and different communication protocol
with Atmel studio or anything else really, you instead make your whole program right into firmware and you upload it with ICSP, you never need to use serial to TTL
also, arduino can't use the advanced features of the CPU such as low power modes, sleeping with interrupt pin enable, disabling/enabling ADC to save power, etc and arduino fills up half of the program memory with a useless bootloader
you can't even put arduino sketches on ATtiny10 which is what I made this program for - why, well, because the arduino bootloader is too big for this little tiny CPU
the problem really with assembly is that you have to type a bit more stuff than if you simply use C, here's the kicker, so before storing values out to configuration registers, the datasheets explain that we should first move all the values we want to store into all the general purpose registers first, then move them over
the problem is that when you send an output, it doesn't synchronize right away because remember that a CPU has a clock and each tick is when something is performed, so you need to use NOP to allow for that sync to happen, otherwise it will keep trying to pull data off the bus
you could theoretically follow each LDI with the corresponding OUT, but then you need to follow it with NOP, so that means in my code I would have like 8 or so extra NOPs that don't need to be there
of course, every CPU ISA (Architecture or Platform) has a different instruction set, so those commands will be different on other CPU arch
someone might be wondering, well, why did I use R16 twice for my outputs in the config section - well, I needed to store b1100 into 2 configuration registers - so the NOP was not needed necessarily in this case because synchronization is not needed to retain the same value in R16, so long as I did not try to modify the value in R16 before the next NOP instruction
; in both DDRB and PUEB due to the fact that
; we are not allowing the CPU to synchronize
; between changes in value of the R16 Register
;
LDI R16, 0x0C ; 0x0C is binary value of 1100
OUT 0x01, R16 ; 0x01 is DDRB Config Register
LDI R16, 0x08 ; 0x08 is binary value of 1000
OUT 0x03, R16 ; 0x03 is PUEB Config Register
NOP```
@fickle aurora I said ''look like'' not that it is arduino. I dislike the platform precisely those reasons
@fickle aurora there is a low power library that gives you all those functions. im currently working on a 328p project that i program with icsp as i have a bt module permanently hooked up to serial0
yea, you should be able to inject assembly code as well, though I haven't tried that on arduino so I don't know if it is possible
you talking about low power ?
yes
I like arduino for prototyping quickly, but the thing is once you have it your best bet really is to bring it to atmel studio and start porting it for efficiency
or you could simply just write it in atmel from the start
id say if u arent running out of space theres little need to port
the thing is that the arduino bootloader firmware is always going to eat power
doesnt matter if not running off battery, also can use arduino ide and program via iscp without bl
bruh just learn C its eeazy
can I program arduino's with holyC?
oh lord please let it be
which compiler are you using in arduino
me?
hayden
the ide
the atmel studio has a lot in it to help port arduino projects to atmel studio and I think XC8 compiler for 8 bit CPUs is free
the default in arduino is avr-gcc so it is technically C
it isn't to the proper C standards that were set long ago though, so it is more like C++ that emulates C
however if you wanted a proper low level C compiler, the XC8 compiler follows the C99 standard
the problem with these GNU tools is that they are open for anyone to contribute to them, so they always move away from the set standards and by doing that, they introduce problems (which could be security problems, emulation bloat, or just plain bad code)
this is exactly what sets GNU apart from BSD licensed projects, so BSD licensed projects for example, in most cases, are restricted to developer teams that are lead by a lead programmer who is often very well educated in combing through the code for problems
its nothing like C++
another great example is Linux versus OpenBSD... yeah, Linux has far more features, but it also has some very major security holes and instability that requires constant patching to fix them... openbsd on the other hand has a lead developer who decides what code can be submitted to the project and it has been around for decades with only a handful of bugs
i dont understand this vibe that because its a 20 year old standard that its somehow lower level
oh no, youre crossing into my holy land of BSD. must restrain my 
linux also has a lead developer that decides what goes into the kernel
and as much as i love bsd, it seems on the surface bsd security is not as tight as linux because of testing, they are similar
I would love to see what theo de raadt would say to that
he would probably give a 3 hour lecture explaining on a machine code level exactly all the security holes linux has, and the fact the teams know about the problems for decades and have never bothered to fix them
im not a big openbsd person specifically, but i think theres plenty of evidence of security holes in it
i personally find it concerning that security and quality come down to just a handful of individuals at least with linux and unix, i surely hope its not the same way for osx and windows
microsoft does a good job on it, the problem is that because they are so powerful, governments force them to add backdoors for intelligence agencies and those backdoors are where the majority of the security problems are
I don't have evidence of it, but there are others who can point out the blatent security holes to microsoft and those holes never get patched up
failure to fix bugs is not the same thing as introducing back doors on purpose
ironically, the same thing is true when theo points out the security holes in Linux
why would MS outright admit to putting in backdoors, that would be bad for PR
of course they wouldnt, but that doesnt mean they wouldnt be found
so do you think stuxnet never happened?
if you assign every bug as a malicious security hole, theres no real way to falsify that kind of thinking
stuxnet was a virus. if they had a backdoor they wouldnt need to write a virus
a backdoor is essentially a transmission conveyance for a virus to use
or its just an unknown vulnerability
theres so much evidence that the us government does not have back doors in
stuxnet was proof that even in the microcontroller world, big companies that are normally trustworthy - in this case siemens - are not on top of security (though they have huge teams of PhD level engineers) to the point that it was pretty obvious there was a backdoor built into siemens controllers to allow a virus to be transmitted in, even if it requires local access to do it
make up your mind, was it an oversight or did they put in a back door on purpose?
back doors are not exploits, theyre intended
we will never know
but the evidence suggests it was not a back door
and the virus spread beyond the iranian centrifuge facilities and went wild on the internet
some more evidence that it wasnt well targeted like a back door would be
the problem is SCADA does not normally allow for a computer to send data to a microcontroller, because that would put all major infrastructure at serious risk
it is normally only read-only data
automated systems that make the controllers work are literally never connected to the internet
evidently their network wasnt severed, or somebody introduced it
in fact they arent even compatible, they use RJ45 plugs for RS485 which would blow your ethernet card if you plugged it in
it was introduced locally according to the wiki on stuxnet
someone had compromised it with local access and likely some USB stick
i think im more concerned with single programmers being buyable than an entire company
minix worries me more than anything else for potential backdoors
but if anyone ever discovered an intentional backdoor in say an intel chip, intel would be a dead company
well here's the thing, especially for people such as yourself who think china is stealing tech from us... the CEO of Nvidia is a chinese guy... the CEO of AMD is a chinese woman... no, they didn't buy in - in fact, Jenson himself founded Nvidia corporation
what? why are you putting words in my mouth?
well because of what you said before, it sounds like you blame china, but I am saying that they literally founded their companies, they didn't steal anything
i would point out lisa su is taiwanese, i think if you believed everyone born in mainland china was a spy, she still wouldnt be included in that
but shes american, not chinese
what did it sound like i blame china for? i dont even remember saying china in months
well there was that
oh i did say that. well thats factually true isnt it?
not really, because C is used by thousands of people and not all chinese
they are doing the majority of work in everything
nah i dont thikn so
not enough people in north america are interested in programming at the CPU level
yah, agreed
i mean i wouldnt say "enough" because its clearly enough
but less people in north america are interested in that
i also dont see it as a problem, this is why i was confused when you suggested i think china is stealing tech or a problem
theyre definitely stealing tech, but i dont think ive ever brought that up
they are doing the majority of work in everything
@fickle aurora well with over a billion in population i dont think its that weird that they van do work in everything
i mean they arent
we are overregulated here, that's the real big problem
chinese nationals are doing like UI development for the world
and frankly embedded device programming is an easier area of development in computer science
it doesnt require a lot of language skills or mathematics
i mean its still hard, dont get me wrong
afaik electrical engineering level of programming uses far more mathematics than software development
the programming? no definitely not
the physics of the hardware at most might use calculus
but the programming is basic arithmetic
what math you use for parsing strings? you need to do bit level stuff for that?
bit level is entirely different
its not different...
try doing EE bit level math all day long and tell me it's not math intensive
software dev has it easy man
game programming is math intensive
yes but few people make games
the game industry is huge
in fact colleges are separating those job titles because most people can't do math
but in EE literally at the bit level, literally everything is math
yes, but its very easy math
digital logic math to compute trigonometry is easy?
you know you can take someone's high school math level and teach them EE development
yes, thats relatively easy
can you explain how I multiply a number when my CPU does not have division or multiplication instructions
i know the development of embedded stuff is still difficult, its just not math heavy
yea you just multiply the numbers like you learned in 4th grade
and division?
long division just like 4th grade too
i mean thats what americans call it, long division
it's quite a bit more complicated than that
its not, i have done it
i mean long division itself is complicated, because there are so many steps
but its basic arithmetic
its just in binary
this is all they give me to work with
its like solving puzzles with a few pieces
but it doesnt require 5 years of math background, thats my point
i remember doing it at 15 years old, long before i knew any complicated math, so ...
i think the physical properties of the chip are a lot more complicated than the programming for it
you know designing a chip like that is extremely complicated, but i think they can get cheap labor to program them
the cheap labour is all in software dev because it's easy
if you want to make money these days it's all in EE, but it's not easy
you know ... 1 programming language?
and you think software development is easy?
have you ever made a program more than a thousand lines of code?
like you mock web development, but web development is like 50 different technologies, its massive
sending commands to sql is hard?
About as hard as boolean math
Obviously web development is a lot more than writing to a database
if you mean making the web server, yeah that is a bit of a project
Not really, a web server is just 1 protocol out of like 20
I mean a single web page uses a ton of different technologies, there's a lot to learn
Most of it is easy but there's tons of it
probably IIS is made in C, though I don't know, but Microsoft has said before that Windows is primarily written in C and C++ with some routines hand made in assembly
windows is made primarily in delphi
or at least it used to be...
i mean its obviously a mix of languages
dunno whos using IIS these days...
well there is this
the API is quite literally the OS in this case, since all the functions of the OS are of course made from the API
i see no real value in developing user-space applications in C
a web server in C# is a horrible idea lol
i just looked it up, IIS is c++
youve got a very narrow view of how things can be or should be done
servers need to be efficient because you have many hundreds of people accessing it
it is ...more efficient than IIS
it can't be more efficient
managed languages are especially "efficient"
C# code is not possible to be more efficient than C++
just like C is not possible to be more efficient than Assembly
you can find areas where some languages are better than others
i would guess if you wrote a program in C it will be compiled faster than if you programmed it in assembly - because you are not as good at assembly as the C compiler is
and if IIS was the fastest web server, and kestrel is faster... (i know it has less features)
but it would seem to me that a web server written in c# is faster than the previously fastest one in c++
you are better off getting apache for windows
and i dont think any c# programmers or java programmers are trying to achieve speeds of something carefully written in c++, but they also consider their time more valuable than wasting weeks for an extra 5% speed
apache is a very slow web server
i think you just always side anti microsoft because you dont know anything about it
apache is slow? compared to your C# web server? lol
a lot slower.
everybody knows this
apache is famously like the slowest major web server
<<<
Kestrel is built to be fast.
When tested on Windows Server 2012 against IIS and at a pipeline depth of 16, Kestrel pushed 1,188,521 requests per second compared to IIS' 57,792 requests per second.
<<<
and IIS stomps nginx and apache and even lighttpd too
are you testing multiple threads?
not my test, you can just find tons of benchmarks of kestrel
they absolutely wreck the competition
and hey its open source and cross platform
apache runs several separate processes because it is multithreaded
it is like a modern CPU in that it will connect users to threads in a way to load balance them
i dont think it matters
if this benchmark is believeable, and kestrel is 20x faster than IIS which is like 2-10x faster than apache...
load balancing with a server is a very big deal
you doubt c# can multithread? youre kidding i hope
yes it can but it depends on the developer
see you cant believe because you believe the myth that managed languages are always worse
but youll be stuck in the 1960s forever
C# is also inherently slow and memory hogging which is why you would never use it to write a server side program
see, but obviously thats not true
you just cant change your mind when confronted with evidence. this is a bias
it is good for client side because client side only handles data on one single user
you wont grow as a developer if youre prejudice like this
yea these are good benchmarks actually
but hey, you are welcome to just keep believing apache must be better even though its not
any network operator would laugh like crazy if you suggested to them to replace apache with this C# web server
i dont think you know many network operators
if I couldn't use apache the next thing in line I would use would be maybe IIS but that's all
theres no reason to be using IIS these days
running a windows server, cmon. thats crazy in 2020
I thought you liked your C# interactive web pages
i like c# for web development. i can do that on linux
IIS is best at that
apache is good because its popular and common
it is good. but not fast.
fast web server not very important anyway, just an example of c# beating c++
with better security, too...
ive used nginx for a while, but bit difficult as beginner getting web apps with htaccess config and having to translate it. in the end i just upgraded my vps and switched back to apache
i learned nginx first, so i actually find it easier than apache, but theyre both rather awful
the configuration format is honestly horrible, some of the worst ive ever seen
nginx is almost like a C style format, but not. and apache is almost like xml but not
the thing is a real web developer needs about 5 different things before they can really be a real web developer - you need a webserver, DNS server to manage your own domains, outgoing mail server, incoming mail server, and mail delivery server to manage individual mailboxes (iirc Microsoft combines all mail server functions in Outlook into one program)
if an apache configuration file is too difficult to manage, I don't recommend being a web developer
just with bind, you will have to learn so many things about the DNS protocol, and then there's DNSsec you have to deal with, and then you have to go through a process with all the major mailservers, such as Google and have them allow your mailserver to send mail to gmail accounts for example, and they require you to set your server up a certain way for that as well
so you need to register with Google as a Bulk Mail Sender for example if you run your own mailserver, and you have to agree to monitor it for hackers who might break in and use your server to send spam - if your server is marked as a spam sender, they will blacklist you with hundreds of companies mailservers and then yours is practically worthless
by default, google will block attachments you send to a gmail account from your mailserver - you have to apply for the Bulk Mail Sender program and you can get a special status which accepts certain sized attachments to go through, also your mailserver must be SSL on server side, if not they will block anything you send, and they also require your DNS server to be verified as well, so you have to be running DNSsec
don't assume you will never be a target for hackers - most of them now are no longer people - they are AI scripts which connect to random IP addresses on the internet, and they keep poking their fingers in your protocols until they find something they can exploit - and this happens in seconds, it's not like in the movies where flashing lights and warning alarms go off - most of the time you don't know it happened until long after
i just use virtualmin and it does it all for me, nearly
now also to add to DNS.. DNS is such a huge thing apart from all this, so you can manage your own zone file for your domain name but this is not enough - you also need to set up the DNS server to be able to communicate with slave DNS servers, usually your data center will have several servers that they offer for slave DNS service, now getting these servers talking to each other is a dreadful process sometimes but you can do it
yes those GUI administration kits are basically no different from a rootkit with a big sign telling the internet you are looking for some fun
maybe virtualmin is better than what I think it is, but I can remember how bad Cpanel was long ago and since then I swore never to use a GUI for administration ever again
but even the most basic web development is going to be like 4 languages
theres countless conventions youve got to learn, its data and model and presentation all together, it takes a huge range of knowledge to be good at
so this is a test I wanted to show you, what it does is prove what I stated about memory management in C a while ago - the null character's memory address can be pulled using this code and shown on the screen... there is always the main string pointer address and then the character array in the string has chronological memory addresses
#include <string.h>
int main (int argc, char *argv[])
{
int i = 0;
if (argc < 2)
{
printf("%s:Command not executed. Format: %s <value>\r\n", argv[0], argv[0]);
return -1;
}
printf("Entered Value: %s\r\n", argv[1]);
printf("String Memory Location: %d\r\n", &argv[1]);
for (i=0;i<=strlen(argv[1]);i++)
{
if (i < (strlen(argv[1])))
printf("Character Memory Location (%c): %d\r\n", argv[1][i], &argv[1][i]);
else
printf("Character Memory Location (null): %d\r\n", &argv[1][i]);
}
return 0;
}``` and here is the codeblock if you want to copy paste it
i dont know what to say. i agree thats how string.h works. i'm not sure what that has to do with the processor
because that library was written in the 70s
this was probably re-written after 2000 because it's a library in GNU C++
C designer Dennis Ritchie chose to follow the convention of NUL-termination, already established in BCPL, to avoid the limitation on the length of a string and because maintaining the count seemed, in his experience, less convenient than using a terminator.
not because of how CPU interrupts work
Entered Value: testing
String Memory Location: 11865380
Character Memory Location (t): 11865448
Character Memory Location (e): 11865449
Character Memory Location (s): 11865450
Character Memory Location (t): 11865451
Character Memory Location (i): 11865452
Character Memory Location (n): 11865453
Character Memory Location (g): 11865454
Character Memory Location (null): 11865455
C:\Users\Allan\Documents\Test>``` So this was what I generally get, if the null character did not exist in memory, I would have instead crashed the program by trying to call an array out of index
because you made it that way
I literally pasted the source code for you to try it out
check this out: http://mike.steinert.ca/bstring/doc/
this is an alternative C library for strings that does not use null termination
you made it use zero termination because you chose to include string.h
it calls &argv[1][i] I didn't add the memory address in a fake way, it is literally linked with %d in the code
I did add the "null" to the text part because otherwise you would just see a blank character
none of this is a requirement of the CPU
this is just how C does strings by default
its not a memory management thing, its not "direct memory access" or whatever you mentioned before
well there is one OS which does not use null termination, that is MS-DOS
no it doesn't. ms dos uses $ termination
in fact, MS-DOS uses $ as a string terminator
thats just the default interrupts, you dont have to use them, and the C libraries dont
everything else uses null character, even MS own API states you need to use it if you build character arrays and want to convert them to strings
the specifications also call for Carriage Return & Line feed for Windows, which is Microsoft-compliant whereas Linux/Unix often only uses the Line feed character
there's a reason these standards have existed for so many decades
because of typewriters?
well, because... they are standards
some people parse files based on standardized things
thats fine. its not a CPU thing
if I parsed a file based on \r\n and the file only used \n, there would be a problem
in the same way cpus dont understand unicode...
similarly, if I parsed only \n, then there would be a \r character everywhere
standards exist for these reasons, so we can follow some semblance of a standard
ok, im not even sure .. what we're talking about
of course, I can solve the Windows/Unix problem simply with definitions, like #define win32 or something
are you going to walk away thinking the CPU requires you to have zero at the end of a string?
so like #ifdef <windows> #then <parse token for windows> #else <parse code for Unix/Linux/Mac>
you know, now that im thinking of the windows API, i dont think even that uses zero termination, most libraries require you specify the string length
for interoperability with languages that dont use zero termination
yah they did, ok
they are trying to make it easier in C# by doing the null termination by the compiler so developers don't have to worry about it, but if you work with memory directly, you will see it there
it's not all that common anymore
you have to quit saying that, when i work with memory directly
i dont think you know what that ...is
youre making up some distinction between it
if i wanted to pass a string to a C api from C#, i would simply pin the pointer (so it can't be moved in memory) and pass the pointer to the first character
the concept of stack/heap is also becoming really confused by newbies entering the field of computers, and it is really hard to fix the damage that the internet causes by misleading people on all the new programming languages that hide the ugly code and make everything easy for people
the only thing that isn't "direct" is that its using virtual memory, the same way it would work in C
theres no confusion in c# between heap and stack. structures/primitives are allocated on the stack, and reference types (classes) are allocated on the heap. its very clear
for the most part, Microsoft worked really hard to make memory management easier for people in C# but there are still some situations where if you do something out of standard that one would not expect someone to perform, it causes major issues with memory
quite literally, if you do something out of the box, you will break your program in C#
its more efficient overall
i mean thats not true, its obvious you dont know about c#
out of the box? lol
with C there is so much more flexibility but you are required to manage every bit of memory manually, there is nothing automatic in C
i think you mean "unsafe" or unmanaged. its very easy to work with fixed memory
@barren quarry we need a new channel, #architype-talk
you see this as a disdavantage, or easier, but this is modern stuff for security
i dont see this as some argument over which language is better. i know them both
different use cases...
basically what hayden is saying, is that the proof I came up with by writing source code to test and show how string pointers work in memory should be hidden from public view because it goes against popular opinion
im not saying anything
its not a "popular opinion", its fact
just that ive been using virtualmin for years and never been hacked
nobody is hiding strings tho
well let's see, I'm the only guy here who put code in chat in the past few days...
its the web apps that get you hacked
this is a moot argument whether doing it is a good idea or not - because nobody is doing it
you are definitely not the only one to put code here, but ok
youre changing your argument and then you say see it makes you correct
I think people who are looking at the chat right now would rather side with the person who can actually write code and has demonstrated this ability
actually its normally pretty quiet in here until recently so i made it ping notify me on all messages, i had to turn that off this mornining after my computer turned itself on in the night and started pinging like crazy for hours at about 3am this morniing my time
its not ur fault, happy to see u use it , even if i dont really folow it all
arguing about some stupid inane shit about c libraries lol
can we summarize this massive debate in a tldr ?
he thinks C is low level, "direct" access to memory, has all these ideas about how CPUs work that it doesnt
I already summarized it by showing proof of how string pointers work by writing the code to test and display the output
thinks C is always faster and better than everything else, thinks software development is easy compared to embedded device programming
lectures me about how C works... stuff i already know
then i tell him ive got a billion years of experience, i know this stuff deep, then he lectures more about it
its because i dont wanna play game, i want to play discord ๐ฆ
your code is fantastic, @fickle aurora, i plead you read this, its short: https://en.wikipedia.org/wiki/Null-terminated_string
In computer programming, a null-terminated string is a character string stored as an array containing the characters and terminated with a null character ('\0', called NUL in ASCII). Alternative names are C string, which refers to the C programming language and ASCIIZ (althoug...
wikipedia is often wrong because they allow too many people to access it, you should use encyclopedia britannica to cross reference information
britannica is nowhere near the same
I don't think you will disagree with anything in it
"lets use a c diff lib to do that" ;p
where wikipedia will have one page of data on any particular subject, britannica will have 50-1000 pages on every subject and more links to sources, as well as re-typed pages from books that are no longer in print
before britannica was on the Internet, they had massive libraries of books and that is where most of their data is from
"encyclopedia britannica" - me thought it died some years ago coz the net
I will admit the majority of wikipedia is good information
Here's an explanation of how C# can directly access arrays just like C: https://www.c-sharpcorner.com/article/pointers-and-unsafe-code-in-c-sharp-everything-you-need-to-know/
its called "unsafe" because its unsafe like C
its still portable, it compiles to native code
unsafe does not mean insecure, it means you need to know what you are doing
yah like guns arent unsafe, you have to know what youre doing. i think we could agree we could call them dangerous
this is why C is not recommended for new people, but to be honest, you don't really understand programming until you can master C
C is great knowledge to have. its also very easy to learn
some people struggle with pointers
you just learn what you need to
theres a lot of convention to learn, but the language itself is small and easy
there are a lot of applications where speed is not really a concern, even a 'slow' language will run more than fast enough with the often excessive amounts of processing power available... even at 4mhz...
i for one prefer the challenge of logic rather than compiler minutia and re-inventing the wheel for every process, i dont think programming focuses around C as programming existed long before C did
but it feels like getting caught up in the masonry rather than the architecture
yeah, before C there was assembly
those did not come before C
they absolutely did
fortran is like early 60s
you thought C was the first high level language?
even BASIC was before C
cobol is definitely not made before C
1959
wikipedia makes that claim but if you read the old books you will see
over a decade before C
the language is freaking called COBOL-60 lol
you think thats just wikipedia making that up?
it's the same as all these people saying there were computers in the 1400s because someone made a sand hour glass once
lol what
this is nothing like that.
you thought C was first, its not. its not even close
they were all working on better languages in the 1960s
doesnt mean they were all available to everyone in the 60s
as much as C was
i mean if you cant even concede historical facts, what are we doing
ill go shoot some wardens
wikipedia is putting the date of when those languages were becoming a thought in someone's mind
theres a picture of the instruction manual
@long raft come join wardens
yah next war
stay forever
every time i join colonials i lose
actually i cant commit to going warden yet. population is too broken
i have a lot of colonial friends now
i feel bad for them...
rreally??
you know, wikipedia also states C is from 1972, right? my book on C written by Dennis M Ritchie literally says it was developed in 1970
i see ... nothing
foxholestats looks the same as last night
theres no big comeback, dude.
coz it failud
seryll says 200 warden advantage last night
says they counted
classic foxhole snowball, we are allergic to even teams, always have been
what do u mean we are allergic too it ?
even before WC, vets hopped servers to play the one they had an advantage on
never play against each other, always play past each other
so theres like always 1 faction now thats oversized, because we cant just change servers and stomp
we take turns taking breaks now
sure, i remember servers where the wardens would just get stomped game after game, day after day because no one wants to join a loosing team
(b4 wc)
one way they could approach the issue to make it really persistent not fake peristent, so the war never ends. there is no winner, no looser
wed need a way to change teams
and if u have a team getting stomped over time it gets more and more advantage to break out
well if foxhole servers are written in C#, that makes sense why they can't handle more than a handful of players per server
it would be a grind tho after like 2 months of that hayden
dude C is his golden hammer
if they see the light and start rewriting a better server side implementation, it will be such a great game
the C is best language anti-pattern
i dont know what their server is written in, i suspect c++
theyre c++ coders
the limit you are thinking of is actually the open files limit
by default I think the limit is like 1024 connections
no thats not the problem
^
they have too many interactions between entities
that is easy to overcome
its probably one of the most difficult problems they have
latency and timings
so much so that theyre developing a new network engine because theres a market failure
foxhole has so few entities though
but they each have a lot of actions
i mean ... i wouldnt agree few entities. it has a lot
compared to a game like eve online where one server can handle like 40,000 entities
how many thousands of buildings and people and vehicles are operating
yes but in eve online they are far apart, and they dont interact
they already split up every map into areas
the player limit is inherrited from unreal engine, and matches other games with the same, which matches pretty much every other mp game for ever, so..
thats for your graphics card to handle
in terms of their servers, they choke when people get close together
the servers dont handle graphics at all
im not saying that
unless you mean the new server side graphics processing which nvidia is working on
that is a new technology not even really available yet
they split the levels so the users can load them
the server is stressed not by the graphics, but by the interactions, which are very large compared to other games
every vehicle and person and gunshot has to be tested for collisions
theres all the crazy ai mechanics, object vs object physics (so you cant walk through stuff)
like which other games? like I said eve handles several thousand on one small area
which are all time sensitive by nature, yet you have time insensitive data transfers
it does, I was in one of those big battles
but even if there were thousands in a small area - their number of interactions is lower
even the data rate wasn't bad
i dunno why im defending the devs. yeah sure their servers should be better. rewrite them in C im sure theyll be perfect then
obviously it solves every problem
the biggest problem for the server end is allocating and storing all the client profiles when everyone all connects at once
wololol yeah profiles are the big problem
well you are familiar with data structures I assume
its not about the profiles, but just the sheer number of connections, essentially ddos situation
every user connected would have a structure with all the data pertaining to them, like their name, their address, what items are in their inventory, etc
Gpu computation is the answer if they're not using it already
if theyre trying to handle the physics simulation of 160 players on a xeon, then yes, GPU computation would be the solution
physics is all client side really, thats why people are able to speed hack and such like that
No it's not actually
they can bypass the calculations
you mean, a special math co-processor would be the solution?
seems like some game servers need a GPU, so makes me think the unreal network engine might be able to use a gpu
if you consider a video card to be a math coprocessor, then yes
you know why math co-processors are better at math than general purpose registers?
ya this seems like maybe theyre doing this already
because they work in parallel and they allow less accurate math
it's in the 5000 page intel 64 and IA-32 architecture book
it would have taken me days to render grom8k without using my GPU
calculations in binary require a lot of CPU cycles to complete
do you mean floating point?
because saying a computer takes a lot of cycles to do math is ... uhhh .. ok?
if instead you could use transistors and resistors to use current dividers to perform math, you could get division problems solved in far less time than would take to perform the same division in binary
you would be surprised, floating point math on the CPU is pretty fast; its about 50% as fast as integer math
they just dont operate in high scale, if you use the parallel instructions you can get parallelism of like 128
but the graphics cards are in the thousands
and again, less accuracy is an option on video cards
and that is exactly why every CPU has a math coprocessing unit with analog to digital conversion
huh
they dont have coprocessors anymore, floating point math is done on the cpu directly
they do digital math
now the problem is that you need to specifically access the math coprocessor registers, the compiler won't automatically use them
youre talking about the new set, like SIMD
funny, in C# i can have them automatically used by the compiler (in mono)
they have math coprocessors inside the CPU instead of outside
long ago it used to be a separate chip
Intel still calls it the x87 Floating Point Unit
oh i didnt know that
thats fun
yah graphics cards have become coprocessors now, not really graphics cards
AMD probably has the same thing, but I have not read their specification
i figured it was its own ALU
the thing is, GPU is slower (clock speed) than CPU, so why not use the math coprocessor on the CPU?
because it can do more
the thing is, C# will not automatically use those registers...
it will actually
a lot of people make that claim but try testing it out and look in debug to see what registers it uses
not when you use + or - implicitly, but when you use the routines, if the processor supports simd instructions they will be compiled to use it
none of the registers it uses are coprocessor ones, in fact, Ive only ever seen it using the regular general purpose registers
it would be the same thing in C, but youd need 2 binaries, one that supports SIMD and one that doesnt
yeah but also depends on your compiler in that case as the compiler makes the determination of which CPU registers to use
and then you might as well go back to using assembly 
this is why hand coding small functions in assembly is worth doing
lol
just custom make some functions to do the math on the proper math coprocessors and then have it return your values
i mean thats what i do, but with the GPU
just in case you thought something was obsolete, Intel apparently has recycled every piece of technology and included it as they made newer products
yah its crazy to think as computers gradually get better each step along there is somebody brilliant making a clever variation that squeezes out just a little more
i've watched the same thing in compression
like television in the us has drastically reduced its radio band because theyre compressing the hell out of it, its fantastic quality at a sliver of the size
it happened over like 15-20 years only
what I am trying to say is that the basic operation of computers hasn't really changed, the only ones saying this or that is obsolete is Microsoft or Apple because they make money on the basis of telling everyone to drop old and buy new
people are trying to do more complicated things faster
in that way its changed
im not a person who believes computing was perfected in 1975
well I almost reinvented the wheel until I learned Intel was using analog signals to perform math...
everyone says computers are all digital
but then again, I might not be on a wrong start, there might just be a business model in math intensive processors that you could plug into a PCIe slot
those are too focused on graphics still
and they have DDR5
well, darn, the bottleneck will still be pcie
you cant beat the price/performance of a graphics card
graphics card programming is very tricky. algorithms that would be fast on a cpu are slow on a graphics card
they can crunch heavy heavy numbers but memory access is their achille's heel
well for math coprocessing it has to convert to analog, measure current across resistors and then convert it back to digital - though it can still do it all in less than 1 tick
to do the same thing in binary would take several ticks
I have to admit I was kind of afraid to try assembly until I played that silly shenzhen IO game several years ago
never heard of it
there is also TIS-100 but that is much harder to play
here I changed the initial test code to actually check for null character and here it is
#include <stdio.h>
#include <string.h>
int main (int argc, char *argv[])
{
int i = 0;
if (argc < 2)
{
printf("%s:Command not executed. Format: %s <value>\r\n", argv[0], argv[0]);
return -1;
}
printf("Entered Value: %s\r\n", argv[1]);
printf("String Memory Location: %d\r\n", &argv[1]);
for (i=0;i<=strlen(argv[1]);i++)
{
if (i < (strlen(argv[1])))
printf("Character Memory Location (%c): %d\r\n", argv[1][i], &argv[1][i]);
if (argv[1][i] == '\0')
printf("Character Memory Location (null): %d\r\n", &argv[1][i]);
}
return 0;
}```
in this new test code, it only prints that null line if the detected character in the array matches '\0'
here is another test showing that you can point to each subsequent address and it will display the string all the way from the address you started from all the way up to the null terminator
#include <stdio.h>
#include <string.h>
int main (int argc, char *argv[])
{
int i = 0;
if (argc < 2)
{
printf("%s:Command not executed. Format: %s <value>\r\n", argv[0], argv[0]);
return -1;
}
printf("Entered Value: %s\r\n", argv[1]);
printf("String Memory Location: %d\r\n", &argv[1]);
for (i=0;i<=strlen(argv[1]);i++)
{
if (i < (strlen(argv[1])))
printf("Character Memory Location (%c): %d\r\n", argv[1][i], &argv[1][i]);
if (argv[1][i] == '\0')
printf("Character Memory Location (null): %d\r\n", &argv[1][i]);
}
printf("Pulling string from each memory address, which will show the string\r\n");
printf("from the selected memory address all the way to the null terminating character:\r\n");
for (i=0;i<=strlen(argv[1]);i++)
{
char *p = &argv[1][i];
printf("Address %d: %s\r\n", &argv[1][i], p);
}
return 0;
}```
and yes of course this testing is being done on Windows 10 Pro with the latest updates, using gcc (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0
since the value of p is technically just a pointer, it is harder to grab one single character, I would have to make a function to copy the whole string from memory to a regular character array and then pick each character from the array to display
but here's the thing right - in C# is it really easy like this to literally just pick whatever you want from a specific memory address? :D
I made a new test, Text3.c, it is a great way to learn how pointers work and will help refresh your knowledge https://pastebin.com/NtKXnEL6
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
with this code you can see when you point to an already stored string, like for example if you say char *value="hello"; char *pointer; and then pointer = value; , the code in Test3.c will prove that the value of pointer will equal the address number of value[0]

Guys I just want you to know I'm supportive of this back and forth about c and this sort of passive epeenery thing you have going on. This is quickly becoming my favorite channel to catch up on. :D
this is like... serious longshot, anyone know if theres a fundamental difference in how games like foxhole or league of legends runs on your pc compared to rimworld and stellaris? Because the latter 2 games freeze my pc within 15-45 minutes of being turned on but the former have literally never frozen my PC in hundreds of hours of gameplay
rimworld and stellaris simply have more objects
more stuff going on at the same time
it has to calculate the pathing for dozens of animals and your colonists
same goes for stellaris ai and ships
it has to do with processing power i guess
i just had it crash on me with this (physical photo since it froze obv)
and i was like minmaxing all my performances, games liek stellaris take up minimum 40 cpu, 40 ram, foxhole has probably same ram, cpu but like double the graphics
it was a 1 man colony at this point anyway even if there are animals
its def hardware issue im just at a loss for what it could be when theres 100 % consistency in what games do and dont freeze the entire pc
the main problem is hardware related, people just don't have enough real memory (RAM) and the rest is page file space - even with SSD page file space, it's not very great because SATA 3 has a top speed of around 500mbps and PCIe has a top speed of around 1Gbps, where even the oldest DDR type memory could surpass both of those metrics
for example, I use DDR3, why, well, it's 10Gbps and I don't feel like I need faster RAM, but you know, I can put all of star citizen on a ramdisk and run it with some RAM to spare, because, well it's a workstation not a regular PC
I can do some pretty crazy things with my computer in fact, in BIOS there are options like memory sparing which will reserve some memory as a backup in case the main memory fails, or I can mirror it which will make it even faster because the memory is split in half and can run in parallel, sort of like RAID disks, all because, well, it's a workstation PC
foxhole of course uses like 2-4GB of memory, I can't recall exactly how much it used but it was well below what I would expect from modern games - other games like star citizen, it will take about 20-30GB while it is running - if you don't have space it will use page file space and run at very low frame rates
there may have been a purpose to this in order to allow people with lower hardware spec to play foxhole, I can definitely see this as an intended design practise
steam has some games that are terrible graphics, they run slow and hog all your memory - those other games are often designed with no care put into memory management - it is probably more efficient to allocate as much memory as you think your program will use - and then develop functions that handle your entire allocated memory block (of course only possible in C/C++), but most people allocate/reallocate as they progress - and if those unused memory locations are not free()'d, then your program will keep growing in memory usage over time until all the memory for the system is being used by that one program
in C# I believe the new keyword is of course for allocating and delete is performs the function of free(), so if you are not explicitly deleting your unused variables after you are finished using them, assuming you created them with the new keyword, then you are just hogging memory that could be used by another program or even reallocated somewhere else
scratch that, Microsoft has removed the delete keyword from C#, so looks like you have no choice but to have terribly inefficient code in that language - supposedly there is a garbage collection system, but regardless, I can't really test how efficient it is since Microsoft wants me to pay them for a license just to test C# - why would I buy it when I can spend money on a 32 bit C compiler for a microcontroller and make better stuff - without EULAs
C removed the delete keyword, richard stalman wants you to pay in feet pics to use his compiler
lol
I am working on a new test you will like, if you are interested, I am trying to help people and also prove what I am claiming using code
oof
yes the whole idea is I want to show how you can allocate more and more memory, and over the course of that, if those blocks are not free()'d, they will still be hogged by the program and you can see it in task manager performance of course
seriously, that richard stalman is into feet and he propositions women and hes got business cards about it. and then he got metoo'd
you dont need to show me how memory works, i already know how it works
for me, I have 64GB mem so I wont be running out, and I just found some cheap used ECC modules the same part numbers that I was looking for, so I ordered more... just for the heck of it :D
ram is really cheap right now
I have to buy only registered ECC for this computer, regular mem cannot work
cool
but the motherboard supports up to 512GB and the CPUs support 768GB or so
takes forever to boot because it checks the entire memory for errors on boot
64 gig chips are about $1000 a piece
but you can get 384GB of ram in smaller chips for about $800 of ECC
that stuff is cheeeeap
for me it's like 50 bucks for a 32GB module on sale
you can buy lots of ram on ebay from old dell servers
yeah I need to buy identical part numbers in order to use memory mirroring
mirroring effectively doubles the throughput
for those who were interested in checking out my new memory allocation test, Test4.c here it is https://pastebin.com/NPQXXv7x it can be compiled with the free GNU C++ compiler for windows called MinGW-W64 which is a Windows 10 64-bit implementation of the GNU C++ compiler and libraries
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.


