elias001
- 380
- 24
@sbrothy thank you again.
You are mistaken here. Different architectures have different assembly languages. Sometimes there even are different versions of an assembly language for a given processor when different OSes are being used, for example with Windows vs. Linux. That said, once you become competent with one assembly language, it's not that difficult to learn how another one does things.elias001 said:I still feel weird about and uneasy about learning a programming language only for a specific architecture then knowing that on a different architecture the same programming language will have differences.
I think the difference between RISK versus CISK is more significant than that.Mark44 said:That said, once you become competent with one assembly language, it's not that difficult to learn how another one does things.
To be more precise, an assembly language is matched to the architecture that it runs on. Different architecture has a different assembly language.elias001 said:I still feel weird about and uneasy about learning a programming language only for a specific architecture then knowing that on a different architecture the same programming language will have differences.
RISC (reduced instruction set computing) instruction sets are smaller than those for CISC (complex instruction set computing), which is fairly obvious if you unpack the acronyms. For a given processor you have registers and memory, and the instruction set provides operators to load into or store out of registers into memory or other registers, to perform arithmetic operations on values in the registers, to branch to other parts of the program, and so forth.FactChecker said:I think the difference between RISK versus CISK is more significant than that.
Ah.Mark44 said:I think he said somewhere along the line, that he had done some programming in C or C++.
I got the (maybe incorrect) impression that RISC programming was harder when there was a great shortage of RISK programmers. Maybe the shortage was due to the initial flood of RISK processors rather than their programming difficulty. I thought that RISK processing was like low-level array processor programming, where you had to keep track of the short time that the output of every operation was available and grab it in that cycle. That was like 3-dimensional assembler language programming.Mark44 said:Although CISC instruction sets have way more instructions, a lot of the time the instructions one uses are more-or-less common to both types of computing.
No, nothing like that. You don't have to keep track of time. That sounds more like low-level real-time programming, as a guess. I don't have any experience doing that sort of programming.FactChecker said:I thought that RISK processing was like low-level array processor programming, where you had to keep track of the short time that the output of every operation was available and grab it in that cycle.
I also think you should look a micro-controllers/embedded systems to gain experience with ASM programming and embedded system design. Embedded systems are much more than low-level programming. IMO spending a lot of time and energy on assembly language for complete programs is a waste of resources for most people in the field. You effectively need to create your own HLL to program larger programs with ASM so it's usually better to use an HLL like C that allows easy integration with ASM for hardware specific functionality.elias001 said:@sbrothy, @Rive and @FactChecker I think all three of you recommended me to try out microcontrollers/embedded systems. So say I wrong an assembly program to control some tiny devices. Is that finished program call "firmware"?
Also the two advanced assembly language books that i have are:
Advanced Assembly Language on the IBM PC by Steven Holzner
and
Advanced Assembly Language by Allen L Wyatt
The two C books with assembly programming are:
C with Assembly Language by Steven Holzner
and
X86 Assembly Language and C fundamentals by Joseph J F Cavanagh.
I do also have that Peter Norton's book.
If I have any other questions about this topic, I will ask in a new post. I appreciate all of you explaining assembly language to me. I still feel weird about and uneasy about learning a programming language only for a specific architecture then knowing that on a different architecture the same programming language will have differences.
device_id_data_t DeviceID_Read(device_id_address_t address)
{
device_id_data_t deviceID;
//Save the table pointer
uint32_t tablePointer = ((uint32_t) TBLPTRU << 16) | ((uint32_t) TBLPTRH << 8) | ((uint32_t) TBLPTRL);
//Load table pointer with Device ID address
TBLPTRU = (uint8_t) (address >> 16);
TBLPTRH = (uint8_t) (address >> 8);
TBLPTRL = (uint8_t) address;
//Execute table read and increment table pointer
asm("TBLRD*+");
deviceID = (device_id_data_t) TABLAT;
//Execute table read
asm("TBLRD*");
deviceID |= (device_id_data_t) (TABLAT << 8);
//Restore the table pointer
TBLPTRU = (uint8_t) (tablePointer >> 16);
TBLPTRH = (uint8_t) (tablePointer >> 8);
TBLPTRL = (uint8_t) tablePointer;
return deviceID;
}
spibmc spi1.1: spi link version 1.3
[ 7.345168] spibmc spi1.1: BMCboard default: do_conf=1, di_conf=1, daqbmc_conf=0
[ 7.346479] comedi comedi0: bmc protocol version 0.96
[ 7.346502] comedi comedi0: 4 cpu(s) online for threads
[ 7.346512] comedi comedi0: BMCBoard chip select : 0x1
[ 7.346518] comedi comedi0: BMCboard hardware rev 3
[ 7.346523] comedi comedi0: BMCboard board revision detection started, board_rev value 0x3
[ 7.346541] comedi comedi0: PIC18F57Q84 DAQ device, SPI slave mode
[ 7.346550] comedi comedi0: PICSL12 device detected, 16 channels, range code 0, device code 0, bits code 0, controller code 3
[ 7.346557] comedi comedi0: BMCboard SPI setup: spi cs 1: 8000000 Hz: mode 0x3: assigned to controller device PICSL12
[ 7.346568] comedi comedi0: 16 bit and less device buffers set to 16 bits
[ 7.348015] comedi comedi0: Analog Out channels 1, Analog In channels 16 : Q84 config code 0x0
[ 7.348039] comedi comedi0: DISPLAY, RS232/TTL and device serial TX/RX channels 8
[ 7.348045] comedi comedi0: Digital Out channels 16
[ 7.348051] comedi comedi0: Digital In channels 24
[ 7.351448] comedi comedi0: ao device thread start
[ 7.351773] comedi comedi0: driver 'daq_bmc' has successfully auto-configured 'BMCboard'
Thanks for clarifying. I conclude that I was just confused about RISK. The demand for programmers when RISK began was probably just part of the startup of RISK. I never programmed or even saw RISK programs and thought it must be like low-level array processor programming.Mark44 said:No, nothing like that. You don't have to keep track of time. That sounds more like low-level real-time programming, as a guess. I don't have any experience doing that sort of programming.
The instructions are not necessarily one cycle. See this reference for cycle times for one version of ARM, a RISC assembly language -- https://www.cse.scu.edu/~dlewis/book3/docs/Cortex-M4 Instruction Timing.pdfFactChecker said:Now that I think about it, the timing of RISK should be simpler than with CISK since all the instructions are simple, one-cycle execution. (I guess)
Mark44 said:The instructions are not necessarily one cycle. See this reference for cycle times for one version of ARM, a RISC assembly language -- https://www.cse.scu.edu/~dlewis/book3/docs/Cortex-M4 Instruction Timing.pdf
AAARRRRRGGGGHHHH!Mark44 said:BTW, the acronyms are RISC and CISC -- neither includes the letter K.
It was more about the scope of typical application. X86 got lot of programmers since it was a widely used open platform. The RISC competed on lot more specific markets.FactChecker said:I got the (maybe incorrect) impression that RISC programming was harder when there was a great shortage of RISK programmers.
Well... not really, but could be felt that way.FactChecker said:all the instructions are simple, one-cycle execution.
Well... no. You can think of CISC instructions as a macro of RISC ones.FactChecker said:I think the difference between RISK versus CISK is more significant than that.
We all ef up from time to time.FactChecker said:Thanks!
AAARRRRRGGGGHHHH!
I hereby disqualify myself from any further comments on this subject.
Amen to that!sbrothy said:We all ef up from time to time.![]()
sbrothy said:Ah.
Looks exciting. I understand there are a lot of DIY projects out there making use of these cigarette pack-size mini-computers like the Raspberry PI and others. Those might make a good place to start a project writing a device driver or something similar.nsaspook said:I also think you should look a micro-controllers/embedded systems to gain experience with ASM programming and embedded system design. Embedded systems are much more than low-level programming. IMO spending a lot of time and energy on assembly language for complete programs is a waste of resources for most people in the field. You effectively need to create your own HLL to program larger programs with ASM so it's usually better to use an HLL like C that allows easy integration with ASM for hardware specific functionality.
My current home project requires PIC18 firmware for a board I designed with just a little ASM for things you can't do in C. The PIC assembly is simple and direct.
https://github.com/nsaspook/mqtt_comedi/tree/fixes/bmc
Reading PIC18 device registers in main.c
C:device_id_data_t DeviceID_Read(device_id_address_t address) { device_id_data_t deviceID; //Save the table pointer uint32_t tablePointer = ((uint32_t) TBLPTRU << 16) | ((uint32_t) TBLPTRH << 8) | ((uint32_t) TBLPTRL); //Load table pointer with Device ID address TBLPTRU = (uint8_t) (address >> 16); TBLPTRH = (uint8_t) (address >> 8); TBLPTRL = (uint8_t) address; //Execute table read and increment table pointer asm("TBLRD*+"); deviceID = (device_id_data_t) TABLAT; //Execute table read asm("TBLRD*"); deviceID |= (device_id_data_t) (TABLAT << 8); //Restore the table pointer TBLPTRU = (uint8_t) (tablePointer >> 16); TBLPTRH = (uint8_t) (tablePointer >> 8); TBLPTRL = (uint8_t) tablePointer; return deviceID; }
This PIC device talks with a Linux system using a kernel protocol driver module that talks to a Orange Pi via SPI.
Driver daq_bmc
https://github.com/nsaspook/mqtt_comedi/blob/fixes/daq_bmc/daq_bmc.c
Code:spibmc spi1.1: spi link version 1.3 [ 7.345168] spibmc spi1.1: BMCboard default: do_conf=1, di_conf=1, daqbmc_conf=0 [ 7.346479] comedi comedi0: bmc protocol version 0.96 [ 7.346502] comedi comedi0: 4 cpu(s) online for threads [ 7.346512] comedi comedi0: BMCBoard chip select : 0x1 [ 7.346518] comedi comedi0: BMCboard hardware rev 3 [ 7.346523] comedi comedi0: BMCboard board revision detection started, board_rev value 0x3 [ 7.346541] comedi comedi0: PIC18F57Q84 DAQ device, SPI slave mode [ 7.346550] comedi comedi0: PICSL12 device detected, 16 channels, range code 0, device code 0, bits code 0, controller code 3 [ 7.346557] comedi comedi0: BMCboard SPI setup: spi cs 1: 8000000 Hz: mode 0x3: assigned to controller device PICSL12 [ 7.346568] comedi comedi0: 16 bit and less device buffers set to 16 bits [ 7.348015] comedi comedi0: Analog Out channels 1, Analog In channels 16 : Q84 config code 0x0 [ 7.348039] comedi comedi0: DISPLAY, RS232/TTL and device serial TX/RX channels 8 [ 7.348045] comedi comedi0: Digital Out channels 16 [ 7.348051] comedi comedi0: Digital In channels 24 [ 7.351448] comedi comedi0: ao device thread start [ 7.351773] comedi comedi0: driver 'daq_bmc' has successfully auto-configured 'BMCboard'
A C program on the Linux machine uses the driver to send and receive data using MQTT to Home Assistant for monitoring and control of a small Solar Energy testing system.
View attachment 365201
View attachment 365202
It's mainly a redesign of a larger system already in use. The Raspberry PI and its kin make excellent platforms for small embedded system if you need interactive control and/or compute capabilities in a small package.sbrothy said:Looks exciting. I understand there are a lot of DIY projects out there making use of these cigarette pack-size mini-computers like the Raspberry PI and others. Those might make a good place to start a project writing a device driver or something similar.
Missed this one.elias001 said:So say I wrong an assembly program to control some tiny devices. Is that finished program call "firmware"?
At a place I worked my webapp had to request data from an IBM CICS [sic!] backend on a mainframe. They kept referring to it as the KIKS server. A little annoying as “kiks” in Danish means biscuit and is a colloquialism (?) for failure.Mark44 said:The instructions are not necessarily one cycle. See this reference for cycle times for one version of ARM, a RISC assembly language -- https://www.cse.scu.edu/~dlewis/book3/docs/Cortex-M4 Instruction Timing.pdf
BTW, the acronyms are RISC and CISC -- neither includes the letter K.