elias001
- 389
- 26
@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.
vs.elias001 said:I was trying to get macro assembler 6 to run on windows 7 with dosbox. I was not having any success.
Rive said:Then for practice you better get a PC from that era. Highly likely won't work on modern PC, with modern OS - but even if you manage to make it work, it won't give you much useful knowledge.
I wasn't aware that Visual Masm existed, but it looks interesting. If it's asking where the MASM 32 SDK is located, that SDK needs to be downloaded before you can continue. If you do a web search for MASM 32 SDK, you'll get links to sites that have it. Version 11 seems to come up first, and it should work with your Windows 7 computer.elias001 said:I was trying to get macro assembler 6 to run on windows 7 with dosbox. I was not having any success. Anyways, I installed Visual Masm. But it installed even though it kept pestering me about where my MASM 32 sdk is located and asked me for locations about ml.exe and a few other things.
I looked at your screen shot, but it was too small for me to grasp what it's showing.elias001 said:Visual visual masm, since I was not sure if it was installed properly and also there were many options for new projects, which I was not sure what to pick. After choosing the first options, I got a blank canvas with template codes. (see screen shot). I was not sure what to do with all those template codes. I mean compare to this online 8086 emulator, I literally get a new blank document where I can write code. I went on youtube and found that I can install masm32 sdk in one video and from another video, I can install the emu8086.
The link to Little Computer 3 doesn't show anything about that type of assembly. However, Wikipedia has an article about it here -- https://en.wikipedia.org/wiki/Little_Computer_3. It appears to be somewhat similar to x86 assembly, but lots smaller and simpler. Since the instruction codes are all 4 bits, there are only 16 instructions in all. This might be a good place to start before jumping into the much more complex x86 assembly.elias001 said:I used Little Computer 3 assembly before. I was not sure how 8086/8088 or any of the intel architecture assembly code is different.
You can download the Community version of Visual Studio for free, I believe.elias001 said:I don't have visual studio installed.
I'm not sure, either, but it might be the Turbo C compiler. Borland Turbo C is a completely different product from MSFT Visual Studio and its C/C++ (and other languages) suite.elias001 said:I don't know what TC.exe is.
Not really. The linker takes as input an object file that has already been compiled (translated into machine code). The linker establishes connections between your code and existing library code; e.g., code for printf and other functions that you didn't write.elias001 said:I know the Linker has to do with compilation and that is about it.
That's really apples and oranges. With regard to x86 assembly, there is a lot of backwards compatibility between older architectures such as 8088/8086 and more recent architectures such as 80386, 80486, Pentium in various flavors, and so on.elias001 said:I dont know if assembly on later architecture is like the comparison between C and C++.
All that is, is a preference by the author of including line numbers.elias001 said:I am seeing a page of code with number on the left denoting line numbers, in other books there are none.
"resource compiler" -- it has to do with Windows resources, such as cursors, icons, bitmaps, dialog boxes, and fonts. I don't need any of these for assembly programs, which pretty much run in the command prompt window. If you decide to go with Visual Studio Community Edition, DM me and I'll help you get started.elias001 said:apparently RC.exe has to do with redource compiler.
Ha! If anything identifies you as a hard-core purist, that statement does! I'll be interested in how that goes.elias001 said:[ for now, I am happy that I have something where I can play with writing assembly code on its own and without having to do it involving C as the third wheel.
I've never used emu8088, but as far as I know, it does not directly interact with the hardware. Likely it displays a set of the 8088 registers (AX, BX, CX, etc.) and shows you how they would change when various instructions are executed. I have a couple of emulators, one for the Motorola 68000 (which was used on early Mac computers) and an ARM emulator that was created by a couple of professors at a university in British Columbia. What an emulator does is to translate assembly op codes for a given assembly language into the corresponding op codes for the machine the emulator is running on. It also maps the registers that one architecture uses to those on the target machine. Also, I don't believe that the emu8088 software uses the Masm32 SDK.elias001 said:I want to first trying it out writing assembly with the Masm32 SDK and emu8088 emulator first. I have a feeling it is not directly interacting with the hardware or much less so than Visual Masm.
Title IBM Color Graphics Simulation on Hercules
;
.XLIST
;
ESC EQU 1BH
CR EQU 0DH
LF EQU 0AH
BS EQU 08H
TAB EQU 09H
NP EQU 0FFH
Bigae EQU 92H
Bigaa EQU 8FH
Smalae EQU 91H
Smalaa EQU 86H
;
ScrnPg EQU 0B000H
;
InterL EQU 2000H
Inter2 EQU 4000H
Inter3 EQU 6000H
UpDisp EQU InterL-80
DnDisp EQU InterL+80
Up3Dis EQU Inter3-80
;
INTER SEGMENT AT 0
;
ORG 10H*4
;
int_10_off DW ?
int_10_seg DW ?
;
ORG 1DH*4
;
int_1D_ptr LABEL DWORD
int_1D_off DW ?
int_1D_seg DW ?
;
ORG 1FH*4
;
int_1F_ptr LABEL DWORD
int_1F_off DW ?
int_1F_seg DW ?
;
INTER ENDS
;
SCRATCH SEGMENT AT 40H
;
ORG 10H
;
EquipFlag DW ?
MfgTest DB ?
MemSize DW ?
IORamSize DW ?
Kb_stat DB ?
Kb_flag DB ?
Alt_val DB ?
Buf_head DW ?
Buf_tail DW ?
Kb_buffer DW 16 DUP (?)
Kb_buf_end LABEL WORD
;
ORG 49H
;
CRT_mode DB ?
CRT_cols DW ?
CRT_len DW ?
CRT_start DW ?
CursorPos DW 8 DUP (?)
CursorMode DW ?
ActivePage DB ?
Addr6845 DW ?
CRT_mod_set DB ?
CRT_palette DB ?
;
ORG 71H
;
BIOS_break DB ?
Reset_flag DW ?
;
ORG 97H
;
Kb_flag_2 DB ?
;
SCRATCH ENDS
;
.LIST
;
HERC2IBM SEGMENT
;
ASSUME CS:HERC2IBM
;
ORG 100H
;
START: JMP H2Init
;
Beep: MOV BL,1
MOV AX,5B6H
OUT 43H,AL
MOV AL,33H
OUT 42H,AL
XCHG AL,AH
OUT 42H,AL
IN AL,61H
PUSH AX
OR AL,3
OUT 61H,AL
XOR CX,CX
Beep2: LOOP Beep2
DEC BL
JNZ Beep2
POP AX
OUT 61H,AL
RET
;
In the case of RISC-V, they've added Galois field instructions to speed up erasure code (RVV), and some have pre-fetch instructions. This is a currently active project at github Intel ISA-L:Mark44 said:The Intel architecture (limited to x86 and x64) is a CISC architecture (complex instruction set architecture) has nothing to do with RISC (reduced instruction set architecture) or ARM, which is a RISC architecture.
I have about 25 Windows console mode X86 64 bit assembly only programs, generally math oriented stuff.elias001 said:
Financial institutions are required by law to perform the math in decimal. Cobol typically does this using packed decimal (BCD). This dates back to the days when Grace Hopper and team developed the Cobol language. Prior to that was plugboard programming (unit record processing) that was also BCD.jedishrfu said:packed decimal format ... COBOL
The old way was to convert the input numbers into integer or floating point to do the math as was done in Fortran.
Current Macs are using ARM M1 and M2 processors (an ARM processor is essentially VHDL that becomes part of the main chip that also includes the GPU (graphics processing unit) and other stuff). Apple no longer makes desktops. They make all in ones that include the main board in the monitor and they make laptops.Mark44 said:I haven't followed Macs lately, but I understand that they now use the same or similar processors as PCs.