How input buffering works

  Рет қаралды 197,952

Ben Eater

Ben Eater

Күн бұрын

Пікірлер: 369
@IndraKumar-ly7qj
@IndraKumar-ly7qj 9 ай бұрын
I like the way u just start the video without intro.
@johngrider737
@johngrider737 9 ай бұрын
I wish all creators had no intro ... I habitually skip the intro so it might as well not be there.
@BlackKingdomEnterprise
@BlackKingdomEnterprise 9 ай бұрын
Me too❤
@dominick253
@dominick253 9 ай бұрын
I believe if you watch one of his playlist it's literally like one just giant video. Proof that Les is more.
@Kabodanki
@Kabodanki 9 ай бұрын
@@johngrider737 sponsorblock has a very specific category for that. I can't live without sponsorblock browser extension now
@XDarkGreyX
@XDarkGreyX 9 ай бұрын
Something something no foreplay
@menloo
@menloo 9 ай бұрын
I think we would all LOVE for you to interview Steve Wozniak, from a technical standpoint. All the interviews ive seen with him are just people asking him about Steve Jobs but I think hearing you ask technical questions to him would be so fascinating. Especially someone like you who clearly appreciates the things he made.
@mo3bius58
@mo3bius58 9 ай бұрын
Im am sure Steve Wozniak would do this. Someone just show Ben's work to him and let that happen !!
@Atlas_Enderium
@Atlas_Enderium 9 ай бұрын
I would love to see this happen
@Katchi_
@Katchi_ 9 ай бұрын
It has all been covered... in nauseating detail.
@SanchoPanza-m8m
@SanchoPanza-m8m 9 ай бұрын
Whenever Woz is on camera the audience is forced to stare into his gaping, upturned nostrils.
@0LoneTech
@0LoneTech 9 ай бұрын
​@@SanchoPanza-m8m Keep your fetishes to yourself, please.
@lis6502
@lis6502 9 ай бұрын
7:53 i love this 80s programmer mindset "we could save a byte". Next up: we could save a nibble by reusing least significant bits there ^^
@axelBr1
@axelBr1 9 ай бұрын
Also have to save every clock cycle, 10% of the CPU's performance is spent reading a character from the buffer!
@Comeyd
@Comeyd 9 ай бұрын
@@axelBr1that’s not what Ben meant. He meant that at the transmission rate of the serial connection, it can process the character in 10% of the time it takes to transmit a single character. i.e. it takes 500us to transmit a character over serial, the computer can read and store that character in 50us. The total “CPU time” (i.e. what the % utilization is) is much lower, as that is the proportion of microseconds used / second reported as a percentage. It’s much closer to 0.005% CPU utilization to read a character! (Assuming it takes 50us to read and store a char)
@axelBr1
@axelBr1 9 ай бұрын
​@@Comeyd I want back and checked what Ben said, and he did say that the processor will spend about 10% of its time in the interrupt handler. Great catch that what Ben calculated was that only 10% of the time to send the character was spent in the interrupt handler and only 0.005% of the actual CPU time was spent in the interrupt handler.
@mina86
@mina86 9 ай бұрын
Well, it’s kind of funny considering that he doesn’t inline INIT_BUFFER or WRITE_BUFFER which would save two instruction each.
@SanchoPanza-m8m
@SanchoPanza-m8m 9 ай бұрын
It was a stroke of genius when he observed that the circular buffer's write pointer's value didn't matter as long as it was set the same as the read pointer's value, and therefore didn't require initialization.
@curtlundgren6867
@curtlundgren6867 9 ай бұрын
In the early 80s I programmed an RCA 1802 in assembly language with 20k of CMOS RAM to buffer incoming data at 19.2k and stream it through a 300 baud modem to a remote printer. The circular buffer in this case was a 16k memory board, which cost $1,100 and drew 5 mA at 5 volts. The data was coming in slowly enough that a simple software poll was adequate, no interrupts were needed. That was a fun project! Thanks for your videos Ben!
@Rowlesisgay
@Rowlesisgay 9 ай бұрын
Cathode Ray Dude will be so happy that the Eater homebrew computer can keep up with his machine-gun typing now
@Rowlesisgay
@Rowlesisgay 9 ай бұрын
Ben Eater is one of the best sources for learning about all sorts of low level stuff, I mean I can barely find anyone else coding firmware for its educational value, and i've been looking, i love this stuff.
@TR3A
@TR3A 9 ай бұрын
I’ve learned more from Ben’s videos than I did from my CS major. Thanks Ben!
@timsmith2525
@timsmith2525 9 ай бұрын
Ben is a great teacher.
@uwirl4338
@uwirl4338 9 ай бұрын
He's great but that can't possibly be true lol
@timsmith2525
@timsmith2525 9 ай бұрын
@@uwirl4338Oh, I think it can be.
@w花b
@w花b 8 ай бұрын
Maybe they were busy partying or slacking off​@@uwirl4338
@faameexplains1192
@faameexplains1192 3 ай бұрын
Concerning
@alexstone691
@alexstone691 9 ай бұрын
I never before realized what a vim god you were as i did not know much of vim, but now i see how efficiently you are moving and deleting stuff
@BreakingYTown
@BreakingYTown 9 ай бұрын
You should watch theprimeagen. He does everything in vim
@krallja
@krallja 9 ай бұрын
he’s actually intentionally slowing himself down and using very few Vim features, because it would be too disorienting for anyone to watch otherwise!
@w花b
@w花b 8 ай бұрын
Yeah, you don't wanna watch William Lin ​@@krallja
@BenjaminWheeler0510
@BenjaminWheeler0510 8 ай бұрын
Vim is awesome! Learning at least vim motions inside your editor of choice is super useful. It took me about 6-12 months to get really comfortable with nvim but it’s totally worth it. Editing is way quicker.
@michaelcoviello
@michaelcoviello 9 ай бұрын
Thank you Ben. Your videos are invaluable to anyone trying to develop at the circuit level.
@RobbBates
@RobbBates 9 ай бұрын
Crazy timing! I just got my version of 6502 up and running just about 10 minutes before this video came out. 55 year old nerd giggling like a school girl after seeing that first "\" pop up in my terminal!! Just a CPU, RAM, EEPROM and 6551. I wrote a relocated wozmon code so I can copy it from ROM to RAM and run the wozmon out of RAM so I can edit the EEPROM in circuit. No more wrestling with arduino programmers. Thanks for the very clear explanations in all your videos.
@jonathanwilk8808
@jonathanwilk8808 9 ай бұрын
You are bringing me back some odd 25 years in the past, when I was learning assembly and interrupt handling with a 6809 platform! Thank you for this!
@ammi7462
@ammi7462 4 ай бұрын
Oh, I can only imagine being back in university and having someone like you as a professor in engineering classes. Given how few people understand the concepts you touch upon, you have certainly made quite a name for yourself. I speak not only of this video, but everything you have produced. People like you ( the hardcore engineers), define our world...with or without the people in suits watching over your shoulder...
@Rodrigo-xf2oe
@Rodrigo-xf2oe 9 ай бұрын
At 7:53 you could have saved a register modification by storing whatever was already in the A register into READ_PTR. It would also make the program a little more deterministic, and allow the caller to specify a value for A, if it wanted.
@der.Schtefan
@der.Schtefan 9 ай бұрын
But, he did?
@Rodrigo-xf2oe
@Rodrigo-xf2oe 9 ай бұрын
@@der.SchtefanHe did `lda READ_PTR, sta WRITE_PTR, rts`. I mean `sta READ_PTR, sta WRITE_PTR, rts `.
@johncochran8497
@johncochran8497 9 ай бұрын
Yup, and his interrupt routine isn't quite correct. Namely, the P register needs to be saved and restored. As things stand, he has a rather nasty unpredictable intermittent bug there. For instance, if the interrupt occurs immediately after a compare, but before a conditional branch that depends upon the result of that compare.
@bradywb98
@bradywb98 9 ай бұрын
I’m pretty sure that the CPU’s control logic pushes the status register to the stack before jumping to the interrupt vector. Then RTI will pop it from the stack. That’s the difference between RTS and RTI.
@johncochran8497
@johncochran8497 9 ай бұрын
@@bradywb98 Yep. I forgot about that little detail and was just about to check the instruction set when I noticed your response. A little niggling memory was bothering me about the BRK instruction. Was thinking it used the hardware interrupt vector, yet the interrupt handler could distinguish BRK from an actual hardware interrupt by some means. Turns out to be bit 4 of the saved status register. And my quick check revealed another trap averted by the 65C02, it clears the decimal flag during interrupts unlike the 6502 which leaves it intact.
@sherhy3689
@sherhy3689 9 ай бұрын
you don't knonw how much we appreciate your content!
@CollinBaillie
@CollinBaillie 9 ай бұрын
For those who know, when Ben pushes the registers to the stack before jumping into a subroutine, why do that outside of the subroutine? Why not push at the start of the subroutine and pop at the end? Else, should you want to call that subroutine elsewhere, you have to remember to push and pop there also.
@anon_y_mousse
@anon_y_mousse 9 ай бұрын
It's the calling convention. If you want a faster calling convention, then use registers, but most software isn't setup for that on 6502's, so only use it in your own code. However, the reason that you can't push inside the function is because the arguments could be stored anywhere by the user and the function doesn't know where to push them from, but more importantly, if they're already in registers then it makes more sense to just use them as registers.
@0LoneTech
@0LoneTech 9 ай бұрын
It's a choice. Saving outside means you can choose to only save once while calling several routines that clobber the same registers, or choose not to save at all since you're in a region the value is not needed.
@wich1
@wich1 9 ай бұрын
What 0LoneTech said, if you push and pull from within the subroutine you end up doing it more often than necessary, say e.g. you call the same subroutine 50 times in a loop you end up pushing and pulling 50 times as well, while pushing and pulling once would have been enough.
@wich1
@wich1 9 ай бұрын
@@anon_y_moussethat wasn’t the question
@anon_y_mousse
@anon_y_mousse 9 ай бұрын
@@wich1 Since you're clearly not a programmer, go ahead and ask what you need clarified.
@garydunken7934
@garydunken7934 9 ай бұрын
Circular buffer implementation in assembly! Feeling so nostalgic. Thanks for the video Ben. Please keep it going.
@mikefochtman7164
@mikefochtman7164 9 ай бұрын
Always a good day when there's a Ben Eater video!
@FuchsDanin
@FuchsDanin 9 ай бұрын
I love your stuff. I write bare metal C on various 8-bit AVR processors and seeing everything at such a low level really helps me with not just optimization but also understanding the how and why. I feel that's the more important part, and I thank you for it.
@SanchoPanza-m8m
@SanchoPanza-m8m 9 ай бұрын
Thank you Mr. Eater, for gracing us with another flawless performance. You have such a thorough grasp of the subject matter that you're effectively leading us on a choreographed dance from problem through to solution.
@sillymel
@sillymel 9 ай бұрын
(13:33) If I did my cycle counting correctly, the interrupt handler takes 53 cycles to execute, but if you include the "context switch" to get from program code to the interrupt handler, it ends up working out to _exactly_ 60 cycles (assuming the interrupt happens between instructions). (15:36) The BUFFER_SIZE routine doesn't modify X, so you can move the PHX instruction down to right before calling READ_BUFFER and get rid of the PLX insruction on the no_keypressed path.
@livinonlimiter
@livinonlimiter 9 ай бұрын
Nothing like a Saturday morning with Ben!
@pavlebn
@pavlebn 9 ай бұрын
Started watching you back in high school when you built your own gpu. Kept on watchin even though I didn't understand much. Feels so good to come back and rewatch some of the stuff after getting my EE bachelor and getting a job in embedded engineering. Great review of core concepts used in microprocessors. Thanks for reigniting my love for programming/engineering and keeping me interested through the years ❤❤
@daselsdis653
@daselsdis653 9 ай бұрын
I love your content, and have been watching since forever ago. But truly, I cannot stress this enough, I got it all, it all clicked, the moment I started toying around with a commodore 64(Emulator or similarly structured system I recommend too). It's old and slow, yes, even frustrating to use at some points, but I KNOW my keyboard buffer, understand it and take it into account after some extensive use of such a barebones sistem. This goes for the general memory map, significant bits in memory and what to flip them to, as well as charsets pointers, etc. I really recommend the experience for other people interested in this field, it make each and everyone of your videos that much more informative and entertaining. (ALSO, as a bonus for the logic aspect of computing, I recommend reasing about multiplexors and demultiplexors, I mean, the theory behind logical sistems, I've truly come to love computing a lot more through a more educated lense, even from an amateurish understanding atm) Lot's of love from Spain! :3
@Bassalicious
@Bassalicious 9 ай бұрын
I literally just finished watching the Wozmon videos when this dropped. Perfect timing.
@Scriabin_fan
@Scriabin_fan 9 ай бұрын
I might just go back to college and get a computer engineering degree. I enjoy this channel too much.
@toastom
@toastom 9 ай бұрын
Ben's videos on logic circuits certainly helped me study for some of my classes! Though I will say that I've learned more from watching his videos about how computers work than I have from classes. Your mileage may vary but my classes were mostly separate EE and CS classes, with only 1 or 2 having combined the two fields.
@JamesPotts
@JamesPotts 9 ай бұрын
I chuckle every time I see your Dynex RS232 dongle. Can't be many of us rocking those.
@mikefochtman7164
@mikefochtman7164 9 ай бұрын
DId a fair amount of 'slow' serial communication and data transfers. Looking forward to watching you get the 'flow control' aspect working (pause incoming data when your input-buffer is full). Then we can talk about putting in pauses to resync the serial clocking between your transmitting program and the 6502 (i.e. ala Kermit or other data transfer protocol). :) Love your videos, great discussions.
@johncochran8497
@johncochran8497 9 ай бұрын
Replace "full" with "nearly full". Assuming that something like XON/XOFF is used for handshaking, you need to allow for any data already in transit to arrive before the sender can stop transmitting.
@sepposyXIV
@sepposyXIV 9 ай бұрын
Kiitos!
@johncochran8497
@johncochran8497 9 ай бұрын
Just prior to 7:50, I was thinking "Why are you setting A to zero? You don't need to do that." And he immediately got rid of that statement. Then he did the rather foolish thing of loading A with whatever random value was in the read pointer. He didn't need to do that. Just store whatever random value is in A into both the read and write pointers. Has the nice side effect of not altering A either. 14:00 LDA changes the status register as well, so you need PHP PLP to save that as well.
@Farull
@Farull 9 ай бұрын
No need for pushing status register on the stack during irq. The CPU does that by itself.
@johncochran8497
@johncochran8497 9 ай бұрын
@@Farull I realized that about an hour after commenting. Perhaps I was thinking about a Z80.
@melkiorwiseman5234
@melkiorwiseman5234 9 ай бұрын
I knew immediately that you should have sent a command to the UART to disable all interrupt requests apart from RBF (Receive Buffer Full) so that nothing else would trigger an interrupt. (So far as I remember, you can do that with the UART so that you don't have to bother figuring out what part of the UART caused the interrupt). I like how you leave your errors in since it helps us to learn "what to watch out for" if we want to do something similar. In this case, I knew what needed to be done, but I've found a lot of your videos informative and learned several things from them.
@CatzHoek
@CatzHoek 9 ай бұрын
It's always insane how you make it seem like you do these without planning in the first take, especially if you seemingly run into typical errors anyone following could run into instead of just doing it perfectly the first time.
@jell0goeswiggle
@jell0goeswiggle 9 ай бұрын
That's the most impressive part to me. I get confused as hell if I have more than one buffer open. I only just figured out how to change my indent tab/space settings for e.g. Makefiles and I felt so accomplished.
@garydunken7934
@garydunken7934 9 ай бұрын
That's what years of experience brings! And he seemed to understand and fix problems quickly too, like that spurious interrupts from floating input pins. A newbie would have taken a long time to figure that thing out.
@frollard
@frollard 8 ай бұрын
Frankly, the ability to pull out an exact-length, carefully and perfectly bent breadboard wire from the drawer instantly is more shocking to me. The permutations and combinations of lengths, bends, and colours is mind boggling.
@polt3rgeist407
@polt3rgeist407 8 ай бұрын
😅
@kinchdeadalus5358
@kinchdeadalus5358 9 ай бұрын
Love your videos
@TimothyHall13
@TimothyHall13 9 ай бұрын
You have awakened in me something that has been dormant for 30 years. TY
@ChrisAthanas
@ChrisAthanas 9 ай бұрын
Incredible clarity
@nonamex3052
@nonamex3052 9 ай бұрын
Me: sad Ben: posts a video Me:happy
@wChris_
@wChris_ 9 ай бұрын
In CHRIN you could only push x once you know you have to read a character from the buffer. This will save 1 byte again. Since you are already optimizing for size (7:53).
@haulin
@haulin 9 ай бұрын
You are right. BUFFER_SIZE does not modify X, so pushing is only required before READ_BUFFER. Therefore no pulling from the stack is necessary in @no_keypressed (15:32)
@ChrisHarringtonMinneapolis
@ChrisHarringtonMinneapolis 9 ай бұрын
Time to drop everything
@Anonynnsn
@Anonynnsn 7 ай бұрын
You're one of the best teachers i have ever know in my life
@electronicscaos
@electronicscaos 9 ай бұрын
I work developing electronic products. We still to this day program MCUs in Assembly, as this allows to save huge in MCU pricing, because we can squeeze the maximum from the speed, the memory and processor capacity from a cheaper controller. The fun part is that some of my codes do implement circular buffer, but without any separated memory or processor managing it. I simply do it internally, so I can simply stack up the received data in the time of interrupt, and the rest of the process will get back to roll as fast as a single clock pulse. And so, when the time to process arrive, the program will roll the buffer and do whatever it gotta do, without spending a bit to additional interrupt coding. Seems like too much work, but my client managed to save millions of dollars last year, just because of this very optimized way of development.
@ice.songpola
@ice.songpola 9 ай бұрын
NEW VID UPLOADED. THE TIME HAS COME !!
@der.Schtefan
@der.Schtefan 9 ай бұрын
My life only exists in the few minutes before, during, and right after I watch a new video upload. Everything else is irrelevant.
@sjair6526
@sjair6526 9 ай бұрын
Well I'll be damned! I got it working. Took me a while to figure out how to run the .sh file in Windows. Also had to learn a lot about paths. Backspace doesn't work like it does in other programs. I get syntax errors if I use it. Don't really know how to use basic, but it does work finally.
@Markus-td9ps
@Markus-td9ps 9 ай бұрын
Your vidoes are very inspiring! I built my own 8-bit computer back then and I now extended it with a serial module and got Wozmon running on it 😁
@sirflimflam
@sirflimflam 9 ай бұрын
Every day there's a new ben eater video, it's a good day.
@lilyjames8948
@lilyjames8948 3 ай бұрын
Brilliant as usual
@theycallmejohn4733
@theycallmejohn4733 9 ай бұрын
Thank you Mr. Eater. Seriously.
@StevenHokins
@StevenHokins 9 ай бұрын
Thank you Ben for another awesome video ❤
@LifeSkillsDelivered
@LifeSkillsDelivered 9 ай бұрын
If university was a man he would be called BEN EATER❤. THANKS FOR THE EFFORT YOU PUT IN TO TEACH US
@skilz8098
@skilz8098 9 ай бұрын
He's back! It's a great day when he uploads a new video!
@Tobobo4
@Tobobo4 9 ай бұрын
A new video already March is already a great month Now to spend 3 days trying and failing to understand this
@idrizpelaj4928
@idrizpelaj4928 9 ай бұрын
This is so interesting! I did this just a couple of days ago for a class!
@4115steve
@4115steve 9 ай бұрын
I've learn a lot from you. Thanks for sharing all you do
@akshanshkmr
@akshanshkmr 9 ай бұрын
It’s a good day when ben uploads
@neilhoskins7814
@neilhoskins7814 9 ай бұрын
When watching one of Ben's videos, I feel like he is speaking a completely different language that I somehow understand, but don't remember learning.
@JohnSmith-vm5cv
@JohnSmith-vm5cv 9 ай бұрын
*notification that Ben Eater posted a new video, immediately clicks* We love your videos Ben, keep them coming.
@chromosundrift
@chromosundrift 9 ай бұрын
Am I right in assuming since the read and write pointers must only be identical, leaving the code as it was at 7:55 would also work, (STA READ_PTR / STA WRITE_PTR) , because the same value is still written to both pointers. The values of both pointers would inherit A's previous value rather than that at READ_PTR. There's no performance difference because LDA and STA for zero page addressing mode are both 3 clocks. There is a higher abstraction reason to prefer one over the other: using A in a subroutine implies to readers of the code, and some static analysis tools, that the subroutine depends meaningfully on the value of A which imposes some theoretical obligation at the call sites. It's arguable that reading A has a lower impact than clobbering it. In Ben's version, both A and the status register are modified by LDA. STA does not modify any registers. If performance was critical, it seems preferable to make the INIT_BUFFER routine into a macro to avoid the cycle overhead of JSR/RTS . Not clobbering A would also make such a macro more usable. I'm guessing it would also use less memory in practice although I haven't done the calculation.
@diogoduarte369
@diogoduarte369 9 ай бұрын
After this video all my inputs will be buff AF.
@chrisblammo123
@chrisblammo123 9 ай бұрын
great video as always!
@falkkyburz
@falkkyburz 9 ай бұрын
Nice! I hope the next video will be about race conditions :D
@UncleKennybobs
@UncleKennybobs 9 ай бұрын
Love these videos
@jonshouse1
@jonshouse1 9 ай бұрын
Great video.... just a small point. You said it yourself in the commentary, read_ptr and write_ptr are offsets, so maybe read_ofs, write_ofs. The base address of the buffer would be a pointer, base+offset is also a pointer, but personally I would not call an offset a pointer as it confuses. Nice work though, I did appreciate it.
@0LoneTech
@0LoneTech 9 ай бұрын
They're also array indices. The choice of words is pretty free here; they are indeed pointers within a page, just like the stack pointer.
@jonshouse1
@jonshouse1 9 ай бұрын
@@0LoneTech A stack pointer would be base+offset as I described. But an array index is not itself a pointer as it needs the offset (base) added to it before it becomes an address. We could argue forever over this one, but the modern accepted use of pointer is that it is something containing an address in the machines native word format rather than any kind of offset. If you include indexes and offsets then almost everything would qualify as a pointer, hence my comment "as it confuses". This is why programming books use "index" for offsets and pointer to describe memory references to clarify the distinction. On modern CPU even address gets vague though, hence being a topic that could argued forever!
@0LoneTech
@0LoneTech 9 ай бұрын
@@jonshouse1 Go argue with the datasheet. This is on the world's most famous 8 bit CPU; its native word size is 8 bits.
@jonshouse1
@jonshouse1 9 ай бұрын
@@0LoneTech I did not say "word size", but "native word format" - if you want to be pedant I guess "native address format", but as I said even "address" gets fuzzy on newer architectures, hence a "topic that could be argued forever", as you so kindly seem keen to demonstrate.
@bugmuff
@bugmuff 9 ай бұрын
Ben you’re incredible. Thanks!!!!
@jesusarias4320
@jesusarias4320 9 ай бұрын
Nice video, as usual. Just a little reminder: The interrupt handler should also deal with the BRK instruction...
@davidvanhorn498
@davidvanhorn498 9 ай бұрын
I've hit those problems when interfacing to other people's embedded systems. My Atmel AVR could easily handle 115200 in both directions, but the other system needed a full mS inbetween chars at 9600, and I've always done my serial exactly as you describe. The key to interrupts is to do absolutely as little as possible in the ISR and get out! I've seen people write an ISR with pages and pages of code, interpreting the string IN THE ISR!! (head.. desk..) I also reserve a byte for counting the chars in the buffer, but I just inc it in the rx char ISR, and dec it when I take a char from the buffer. +1 on using a buffer size which is a binary multiple as well. Then overflow is handled by masking rather than calculation. I wouldn't call any routines from the ISR though, the call and return wastes time. When I init the buffers, I take the time to fill the buffer with something like 'A' or whatever so I can easily see where it is when debugging with an ICE. Very well done!
@justinnamilee
@justinnamilee 9 ай бұрын
Absolutely neat.
@SharafatHussain-ow7hc
@SharafatHussain-ow7hc 9 ай бұрын
Sounds good!
@theantipope4354
@theantipope4354 9 ай бұрын
I'm really enjoying this series; it's reminding me a lot of my HW & SW hacking days in the 80s! I'm curious to see how you react when you discover that CTRL+C no longer works while a Basic program is running. ;) Also, you need to implement CTS/RTS handshaking, which would've eliminated the (original) need for the input buffer. You also need to implement error handling for when the buffer overflows.
@stathere
@stathere 9 ай бұрын
Thanks for the interesting content!
@Elia90570
@Elia90570 9 ай бұрын
nothing is better than after a hard day seeing ben eater upload a new video.
@francisbacon-moneygrabber9996
@francisbacon-moneygrabber9996 7 ай бұрын
Ben! Where are you! Missing your new premium deluxe brain-fuxx videos! IT-basics, cpu, bus, no caching, no pipeline, all that, thanks to you I got an idea what the basics are. Thanks a LOT from Austria!
@Witherman39
@Witherman39 9 ай бұрын
Hello new addiction
@IragabaYvonDoneil
@IragabaYvonDoneil 9 ай бұрын
That's really cool, You code in Assembly flawlessly which is not the case for me.
@onebeartoe
@onebeartoe 9 ай бұрын
Thanks for sharing!
@hugonottmayr
@hugonottmayr 9 ай бұрын
I mean surely we can't be too far away from the day when he starts a video with: "so I've hacked into the pentagon from my homemade breadboard computer"
@BlackKingdomEnterprise
@BlackKingdomEnterprise 9 ай бұрын
As usual very good video
@jovetj
@jovetj 9 ай бұрын
❤Love that typeface
@yearswriter
@yearswriter 9 ай бұрын
O wow, awesome!
@cbmeeks
@cbmeeks 2 ай бұрын
I would love to see you interface a video chip like the TMS9918 or even an audio chip like the SN76489 or AY-3-8910. Or...even a Pico to do something cool. Just keep this series going!
@BlAcKpHrAcK
@BlAcKpHrAcK 4 ай бұрын
Thank you, for your accuracy and brief communication.
@n8wrl
@n8wrl 9 ай бұрын
Fabulous stuff. One thought - it's been a loooong while since I've done any assembly programming. My habit at the time was for subroutines that modified registers to save those registers for me. Move the push/pops to the beginning/end of the routines themselves as opposed to having the caller have to accommodate. I noticed a couple of places where you used your new buffer routines that you said "have to remember to save X." What do you think?
@nanolith
@nanolith 9 ай бұрын
This comes down to a balance between style and efficiency. Most ABIs include registers that must be saved and those that will be modified. Since a 6502 has so few registers and performance is more critical, I think that uniform register spill and load requirements would be too costly, both in terms of CPU overhead and in terms of ROM space. A comment is probably more instructive, and it may save a push or pop, since the caller is free to manipulate spills or loads to avoid them.
@clarkmike0723
@clarkmike0723 8 ай бұрын
I thought you stopped to make videos about computers... you are cool dude😊
@scome98
@scome98 9 ай бұрын
Mesmerizing
@Alien426
@Alien426 9 ай бұрын
I wonder if Mr. Eater would be more efficient without the code completion running. He never seems to use it (except at 11:34), but it must be distracting to have the choices pop up.
@DanielMelendrezPhD
@DanielMelendrezPhD 9 ай бұрын
Motion to award Ben an Honoris Causa PhD in Computer Science
@brendanvogele2531
@brendanvogele2531 9 ай бұрын
I would love to see a video on the 6532 RIOT next!!
@vicr123
@vicr123 9 ай бұрын
17:43 after realising spurious interrupts were being generated: NNNNNNNNNNNNNOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!
@lis6502
@lis6502 9 ай бұрын
12:13 phx phy? Are they legal 6502 opcodes or compiler marcos? Because i was raised in PHA; TXA; PHA; (interrupt service routine); PLA;TAX;PLA;RTI fashion.
@fatemonkey
@fatemonkey 9 ай бұрын
This is a Western Design Center 65c02, which has those instructions natively.
@lis6502
@lis6502 9 ай бұрын
@@fatemonkeysigh, me being old fart be like ;P thanks! actually WDC gave handful of new toys to programmers without extra cost if not cheaper (phx takes same 3 cycles as pha and one doesn't have to bother transferring X->A), neat.
@vinnysworkshop
@vinnysworkshop 9 ай бұрын
Here is a suggestion for you: The computer runs on programs uploaded directly to the EEPROM. So, if you give the computer video capability, then add a couple buttons as inputs, you can use the computer as a video game console if you upload the correct program to the EEPROM. Electronics are fun!
@marcusk7855
@marcusk7855 9 ай бұрын
Awesome.
@MikelNaUsaCom
@MikelNaUsaCom 9 ай бұрын
nice job
@Tomyb15
@Tomyb15 9 ай бұрын
I got confused for a moment a couple times with WRITE_PTR and READ_PTR because despite being called pointers, they are actually just offsets. Otherwise, great edutainment.
@williamsquires3070
@williamsquires3070 9 ай бұрын
I think the WRITE_BUFFER subroutine needs to be something like this pseudo-code: if (WRITE_PTR == 0xFF) && (READ_PTR == 0) { // fail } else if (WRITE_PTR == READ_PTR-1) { // fail } else { *(WRITE_PTR)++ = Acc // the 6502 Accumulator } This way, the write pointer doesn’t overrun the read pointer. Here, “fail” could simply be an RTS, or maybe a JMP to some routine in the kernel ROM to “dump core”. Maybe it could even send the character (0x07) to beep the speaker locally, or at the terminal. This way, if a running program isn’t expecting input, but the user falls asleep on their keyboard (ouch), it’ll beep at them until they wake up. 😀 Heck, it could just clear the buffer and drop back into Wozmon.
@Thorsummoner0
@Thorsummoner0 9 ай бұрын
Ben you lovely person. It might be useful to take a moment and side track to running these same programs on a qemu, that might enable the studious to follow along with the assembly dev even if they don't have a hand crafted computer in front of them
@Nunya58294
@Nunya58294 9 ай бұрын
I love coding! Thanks for this, Ben!
@adriagonzalezroige1337
@adriagonzalezroige1337 9 ай бұрын
Omg my day just got better 🙏🙏🙏🙏🙏🙏🙏
@sunofabeach9424
@sunofabeach9424 9 ай бұрын
BEM EATER LET'S GOOOO
@GoGo-c7x
@GoGo-c7x 4 ай бұрын
I LOVE YOU ❤
@todbot
@todbot 9 ай бұрын
Which MacOS serial terminal program is that? I like the "Pacing" option. (Thanks Ben for this series, it's fun!)
@NathanTallack
@NathanTallack 9 ай бұрын
+1
@roostertechchan
@roostertechchan 9 ай бұрын
I think it's "Serial"
@cbbcbb6803
@cbbcbb6803 4 ай бұрын
Basic did not have to have line numbers. Microsoft "GW-BASIC" required line numbers. Other versions of Basic did not require line numbers.
@bogganalseryd2324
@bogganalseryd2324 3 ай бұрын
I loved GFA basic, was an epic language. I even did some coding in 2015 on it lol 😂
@PaulGrayUK
@PaulGrayUK 9 ай бұрын
In the old days, 300baud hid all these problems. Still works today.
@johncochran8497
@johncochran8497 9 ай бұрын
300 baud? Such a speed demon. The ASR 33 ran at 110 baud and we liked it. And even then, if it was being used as a printer as well as a keyboard, NULS needed to be sent as padding after lengthy operations such as carriage return and line feed.
@jaaptaal
@jaaptaal 9 ай бұрын
Could you please explain why it's not a problem that the interrupt request (like you mention at 11:48) changes flags. Couldn't it be a problem when "normal" code is interrupted in the middle of an operation that relies on the value of flags?
@johnrumm4786
@johnrumm4786 9 ай бұрын
The CPU itself stores the flags on the stack when it handles the interrupt. The RTI instruction then pulls it from the stack before it pulls the return address.
Binary to decimal can’t be that hard, right?
42:26
Ben Eater
Рет қаралды 830 М.
Running MSBASIC on my breadboard 6502 computer
36:53
Ben Eater
Рет қаралды 233 М.
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
JISOO - ‘꽃(FLOWER)’ M/V
3:05
BLACKPINK
Рет қаралды 137 МЛН
Hacking a weird TV censoring device
20:59
Ben Eater
Рет қаралды 3,3 МЛН
Can you fit a whole game into a QR code?
20:03
MattKC
Рет қаралды 9 МЛН
I Saved an Electron Microscope from the Trash
34:54
ProjectsInFlight
Рет қаралды 901 М.
I never understood why you can't go faster than light - until now!
16:40
FloatHeadPhysics
Рет қаралды 4,8 МЛН
Coding Adventure: Sound (and the Fourier Transform)
43:31
Sebastian Lague
Рет қаралды 459 М.
How a Microcontroller starts
28:49
Artful Bytes
Рет қаралды 64 М.
World's worst video card gets better?
44:25
Ben Eater
Рет қаралды 846 М.
🎈🎈🎈😲 #tiktok #shorts
0:28
Byungari 병아리언니
Рет қаралды 4,5 МЛН