C and Assembly Language: How To!

preview_player
Показать описание
Dave shows you how to combine C and ASM in the same project and same binary, while keeping them separate and avoiding inline assembly. Featuring 6502 C and ASM on the Commodore/MOS KIM-1
Рекомендации по теме
Комментарии
Автор

"Hey it's Dave, operating system developer for the Kim-1"

ClankioAi
Автор

I understood about 5% of this, but still enjoyed it and look forward to more 😊

spazda_mx
Автор

ClearScreen is very unoptimized!
1. You need to clear 320x200/8 = 8000, but your program clears 8192, that is extra 192 times internal loop, which for 6502 is way too much extra.
2. Handling the outer loop is very slow! If you do the math (but it is obvious in the code too), outer loop is 32 ($20). So you could optimize that by:
LDX #32
... <inner loop>
DEX
BNE :-
This way you will reduce the instructions in half (from 2 to 1), and the generated code will be just 1 byte (instead of 4 as it is now).

SquallSf
Автор

Fun project! Reminds me of when we did something similar back in the early 90's (our undergrad days) - buddy and I started by reverse engineering and writing an application that did the same thing as Norton Disk Doctor in C. This was in the pre-Windows days and on the old (state of the art back then) 80286 based computer with floppy disks since PCs were not as widely available in our country back then and we had to do all the development after school hours by reserving computers in our school's lab (unless the seniors wanted it for their projects).

Anyways, once we re-wrote the entire thing in Assembly, boy was it fast! Much faster than Norton's version and about 2.x times faster than our own C based version. Love watching these videos - brings back some nostalgic memories. Thank you, Sir! 👍

topperdude
Автор

Love it. These small projects in C and Assembly on the older hardware along with the makefile overview are short and sharp enough to practice with, even if I have to convert it to 680xx Assembly and C on the Amiga. The structure and procedures are essentially the same. Thanks, Dave!

milk-it
Автор

I liked this a lot! 6502 assembly on the Apple II is where my computer education began. Assembly and C are still are still what I enjoy the most. It's the proliferation of platforms that has kept me busy.

d.jensen
Автор

The Z80 has an instruction that makes setting a load of bytes to the same value, so the CLS function in Z80 is effectively (once the registers have been setup) a single opcode. I used this to amaze my computing teacher in 1981. Happy days!

morganskinner
Автор

I had a Commodore 16 when I was a kid and spent a lot of time messing with the monitor and writing assembly with it and began playing with self modifying code. It was instrumental in me building a love for coding in assembly which I did professionally for quite a few years albeit with 4-bit and other 8-bit families primarily.

I've spent time with higher level languages but never developed the same affection that I have for assembly.

rjy
Автор

I'm just smiling... old school stuff... back to the good ol' days!

RonaldvanderPutten
Автор

Thank you! I have done this in a hacky way in SDCC +SDAS so I am delighted to see some additional perspectives on this sort of thing.

stepannovotny
Автор

Brings back good memories of writing hardware-specific code, and lots of days debugging interpreted languages by looking at machine code.

naukowiec
Автор

Good stuff, Dave! I never worked in 6502 assembly, but it looks close enough to old 8-bit micros that I programmed in the past that I was able to follow the code pretty well.

RonZuckerman
Автор

Haven't mixed C and asm since mid 90's. Brings back memories.

mcmaddie
Автор

Awesome! I still think stories/explanations of Windows internals were the best and most interesting content on this channel, but this is awesome too.

stonedhackerman
Автор

This is great. Thanks. I love how you dont waste time getting into a project.

jacoblf
Автор

Very nice, only looked at assembly briefly in 1st year cs when I wasn't paying attention - now I understand the beauty of it

toast_on_toast
Автор

Great video Dave, I'm really enjoying this series.
In the pursuit of performance, I'd probably have unrolled those loops from the start at the expense of a little more memory, but seeing it run it looked fast enough!
Great work!

chrisdixon
Автор

Thanks for creating this well done video. Was a trip down Memory lane for me. My programming career began in the late 70’s early 80’s writing 8080, then 8085 assembler ( better ICE) using an Intel MDS210. I was building Industrial apps on Single board processors. I vaguely remember using using the linker/ locator to place code into specific addresses ( read) EPROMs. I had one eprom that I could interchange with variable data. The blurry good old days. 😊

carltone
Автор

Brings back memories of the coding I did during the 80's and 90's in a steel mill in Northwest Indiana.

Davemte
Автор

Nice to see the combo, thank you dave

jemdeweare