Learning Assembly and computer architecture for x86

  • #51
@sbrothy thank you again.
 
Technology news on Phys.org
  • #52
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.
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.
 
  • Like
Likes FactChecker
  • #53
Mark44 said:
That said, once you become competent with one assembly language, it's not that difficult to learn how another one does things.
I think the difference between RISK versus CISK is more significant than that.
 
  • #54
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.
To be more precise, an assembly language is matched to the architecture that it runs on. Different architecture has a different assembly language.
The higher level languages have standard versions that should run properly on any compliant machine.
 
  • #55
Which is also why I’m a little surprised that @elias001 chose to start at assembler level and not, say, C, which is what I did. But to each his own.
 
  • #56
FactChecker said:
I think the difference between RISK versus CISK is more significant than that.
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.
I've written code in Intel x86 and x64 assembly (CISC) as well as MIPS and ARM (both RISC). 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.
 
  • Like
Likes FactChecker
  • #57
sbrothy said:
Which is also why I’m a little surprised that @elias001 chose to start at assembler level and not, say, C, which is what I did. But to each his own.
I think he said somewhere along the line, that he had done some programming in C or C++.
 
  • #58
Mark44 said:
I think he said somewhere along the line, that he had done some programming in C or C++.
Ah.
 
  • #59
@sbrothy I went through C, and now am going through the book Introduction to computing systems from bits & gates to C/C++ & beyond. When i first said I was going through this book, it forgot to put down the first part since the second part of the title was much more memorable and easier to remember for me. Anyways, the book has the Lc3 mini assembly language. As you know and I soon found out the x86 family of architecture, there is no online emulator/simulator and the more i looked around, the more confusing and the more questions I ended up having. Also, some of those old assembly language books had sections on how to sort stuff. Though none of them discusses data structures in full that one would find in a C book
 
  • #60
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.
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.
 
  • #61
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.
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.
 
  • Informative
Likes FactChecker
  • #62
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.
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.

1757116365485.webp


1757116525619.webp
 
Last edited:
  • #63
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.
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.
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)
 
  • #64
FactChecker 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)
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.
 
  • Informative
Likes FactChecker
  • #65
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

Thanks!
Mark44 said:
BTW, the acronyms are RISC and CISC -- neither includes the letter K.
AAARRRRRGGGGHHHH!
I hereby disqualify myself from any further comments on this subject.
 
Last edited:
  • #66
FactChecker said:
I got the (maybe incorrect) impression that RISC programming was harder when there was a great shortage of RISK programmers.
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:
all the instructions are simple, one-cycle execution.
Well... not really, but could be felt that way.
source
1757179512455.webp

Execution of one singular instruction was always multiple cycles, but there was several instructions in the pipeline simultaneously, with one 'released' each cycle (if conditions were right).

FactChecker said:
I think the difference between RISK versus CISK is more significant than that.
Well... no. You can think of CISC instructions as a macro of RISC ones.
And beginning with the Pentium Pro in 1995 (last 'real' x86 CISC from Intel was Pentium in 1993) it was all about the CPU decoding the complex CISC instructions into standardized RISC ones internally, to be executed on a RISC core inside.
 
Last edited:
  • Agree
  • Informative
Likes Mark44 and FactChecker
  • #67
FactChecker said:
Thanks!

AAARRRRRGGGGHHHH!
I hereby disqualify myself from any further comments on this subject.
We all ef up from time to time. :woot:
 
  • Like
Likes FactChecker, Rive and nsaspook
  • #68
sbrothy said:
We all ef up from time to time. :woot:
Amen to that!
 
  • #69
sbrothy said:
Ah.

Then thinking more about it, I retract my comments on sealioning and apologize unequivocally. I obviously misunderstood @elias001 's level of commitment.

Sorry.

EDIT: So yeah, we all ef up from time to time. :woot:
 
  • #70
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
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.
 
  • #71
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.
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.


1757211359042.webp

1757211428540.webp

Solar panel ADC front-end for processing low light-level signals.

1757211568244.webp
 
  • #72
elias001 said:
So say I wrong an assembly program to control some tiny devices. Is that finished program call "firmware"?
Missed this one.
Well, yes. Firmware is the software of an embedded system: usually installed in factory and not meant to be modified by the user. So if you 'finish' it and it is doing something for you, then as 'factory', you have the right to call it firmware :wink:
Can be anything from a few kB code to a complete OS with a GUI.
 
  • #73
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.
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.
 
  • #74
@sbrothy @Rive @FactChecker

Sorry I have not replied. 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. With 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. I used Little Computer 3 assembly before. I was not sure how 8086/8088 or any of the intel architecture assembly code is different.

The first thing I want to ask is that in one of the youtube video, The person installed both MASM32 sdk and emu8088 but then he writes code on emu8088, but on another video, another youtuber simply installed emu8088 and started to write code. Do I really need MASM 32 sdk? I am not sure what it is used for. It seems it is also an ide environment for writing assembly code. I am having a lot of hestiancy because I am writing code that talks to the hardware. Is not like writing C code where there is a compiler and a linker. Kind of like having two guardian angles/parents who are the go between the coder and their machine. I mean the compiler always has the interest of the coder in mind. I don't want down the line where I accidentally wrote something innocent and brick my old computer.

@nsaspook I see you love your physical toys. I actually gone through some of those digital logic design stuff about circuits, integrated circuits, etc in the computing systems text I mentioned in my earlier post. If I want to learn more about that, since many of those books have chapters on vhdl, or verilog. I should always aim to read from the latest edition if any of those book comes in multiple editions? Also, is it best if I can get one that is published within the last five years. I mean there would be a difference if I find a book on digital design that was published in 1978.

Also, since all the hardware description languages have to do with hardware, I can do all the programming, designing tasks, simulations that I want for any physical electronic components. If I want it to get it build and don't want to do it myself. I can always have someone else to do it for me?? I am asking because I have never done any tinkering with electronic components, so I have never done any soldering, brazing, welding, etc. I don't have good hand eye coordination and only functional depth perception. Basically for working with electronic components, is it as dangerous as working with corrosive acid in a chemistry lab?

Lastly my understanding is that all the hardware description language's syntax are based on existing high level programming languages, are there HDL equivalent to assembly language?

Also programming in either assembly or in a HDL are very separate tasks. Meaning when coding in assembly, or in an HDL environment, I can't insert one into the other like how in C, i can have inline assembly code, or in another programming language, i can have inline C code?
Visual MASAM 1.webp
Visual MASAM.webp
 
Last edited:
  • #75
elias001 said:
I was trying to get macro assembler 6 to run on windows 7 with dosbox. I was not having any success.
vs.
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.

An emulated C64 would be up faster. And it's also more 'alive' than 8088 ...
 
  • #76
@Rive I know i am coming across as a total noob. That is ok, I admit I am one. I just don't want to accidentally break anything. Also, if I were to try it woth microcontrollers, would there be a chance I might break something because of some careless coding mistakes? That is why maybe I should learn assembly language programming properly. I know i won't ever be writing the equivalent of roller coaster tycoon. But the more i know, the more chances that I will know what not to do when it matters and will save me a lot of headaches.
 
  • #77
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 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.

For Visual MASM you need ml.exe, which is the Microsoft assembler and linker. The assembler translates your assembly code into machine language, and the linker generates the rest of the code so as to produce a complete program. For the assembly code that I write, I use MSFT Visual Studio, which includes everything I need to write both x86 and x64 (64-bit) programs. All of my assembly programs consist of two parts: a driver program, in C or C++, and a file with assembly code. The C or C++ code contains main(), which calls one or more assembly PROCs, which main() thinks are functions. The compiler translates the high-level code to machine code, the assembler translates the assembly code to machine code, and the linker combines the two sets of code into a complete program (an .exe file).

I'm not familiar with Visual MASM, so don't know what it comes with or what other stuff you need in addition to it.
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.
I looked at your screen shot, but it was too small for me to grasp what it's showing.
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.
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.
 
  • #78
@Mark44 I edited my post to make the screenshots full image. Visual Masm also asks for Link.exe, RC.exe, and lib.exe. I don't have visual studio installed. When I asked Google, it tells me I need to look into my visual studio C++ directory. That sounds super complicated. I don't know what RC.exe is. I know the Linker has to do with compilation and that is about it.Also I dont know if assembly on later architecture is like the comparison between C and C++. In some books, I am seeing a page of code with number on the left denoting line numbers, in other books there are none. There are just too many things I don't know or not sure about.
 
Last edited:
  • #79
elias001 said:
I don't have visual studio installed.
You can download the Community version of Visual Studio for free, I believe.
elias001 said:
I don't know what TC.exe is.
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 know the Linker has to do with compilation and that is about it.
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 dont know if assembly on later architecture is like the comparison between C and C++.
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 am seeing a page of code with number on the left denoting line numbers, in other books there are none.
All that is, is a preference by the author of including line numbers.

Again, I'd advise starting with the Little Computer 3 to get a taste of assembly programming. Once you feel comfortable with that, then you could move into the much more complex world of x86 assembly.
 
  • #80
@Mark44 I did start with Little computer 3, is moving behind it that I am not sure about. Also I meant RC.exe not TC.exe. I asked Google, apparently RC.exe has to do with redource compiler.
 
  • #81
elias001 said:
apparently RC.exe has to do with redource compiler.
"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.
 
  • #82
@Mark44 I really appreciate the offer. 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. If I run into any problems, I will either DM you or create another post and ask for help. I have a feeling I might need to ask questions about assembly programming down the road, but 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.
 
  • Like
Likes FactChecker
  • #83
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.
Ha! If anything identifies you as a hard-core purist, that statement does! I'll be interested in how that goes. :smile:
 
  • #84
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.
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.
 
  • #85
x86 assembler relies on a lot of keywords. Here is part a conversion routine I wrote many years ago.
Code:
    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
;
 
  • Like
  • Informative
Likes FactChecker and elias001
  • #86
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.
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:

Intel ISA-L riscv64
 
  • #88
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.
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.

IBM's early database programming interfaces like ISAM (Indexed Sequential Access Method) were implemented as macros in assembly language, so there is a huge legacy of Cobol + assembly code applications.
 
  • Like
  • Informative
Likes jedishrfu and FactChecker
  • #89
Mark44 said:
I haven't followed Macs lately, but I understand that they now use the same or similar processors as PCs.
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.
 
Back
Top