Maker Pro
Maker Pro

Question on assembly code

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
So a little background on my project first, I am currently building a single board PC using the 8088 processor and supporting chips, i am about to start wiring in the ROM and RAM chips, the ROM will either be an AT27C256 or an AT28C256, RAM chip is currently undecided. Anyway i am very new to assembly, but i have decided this is a good oppertunity to learn it. So when the 8088 boots up it looks for the boot code at FFF0, which means i will need to be able to have the boot code be stored in that address, this boot code will just be a few simple instructions to point the program to the beginning of the ROM code
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
So when the 8088 boots up it looks for the boot code at FFF0, which means i will need to be able to have the boot code be stored in that address, this boot code will just be a few simple instructions to point the program to the beginning of the ROM code

I am not understanding what you mean above. Did you reprogram the 8088?
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
The 8088 is not programmed, it is just a processor, requires all other parts externally: clock, rom, ram, etc. when the 8088 is powered up it addresses FFF0(in my case, not using all available address lines) and starts executing the code from that location, for this boot code you only have address FFF0 - FFFF, so in my program i will need to start with an instruction for the assembler to make sure my first few lines of code are programmed to this address, maybe with the ORG instruction?
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Ok, so this is basically the processor from an old XT or similar. Isn't the first call to the bios chip for POST?
You could always point the boot code to the next section if you have a lot of code with a label. Have you tried 'goto start' then label your next section 'start'
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
I haven't wrote any code yet, just something i was thinking about since i will be doing it soon, still have more wiring to do, This board will basically function like a modern day microcontroller, except im using the 1980s technology, most of the functions contained inside of a modern microcontroller will be handled by external chips, its basically useless by todays standards but i thought it would be a fun little project. as for code i was thinking, if i started with
ORG FFF0, this will set the start point of the code right? it has to start here this is hardwired into the processor where it starts executing instructions from, so a very small program could fit in this 16 byte space of memory, but if larger, which it most likely will be it will need directed back to a different address where there is more available space in the rom
 

Attachments

  • IMAG2492.jpg
    IMAG2492.jpg
    169.2 KB · Views: 161

hevans1944

Hop - AC8NS
Jun 21, 2012
4,889
Joined
Jun 21, 2012
Messages
4,889
Well, good luck getting that board full of parts to play together nicely. Personally, I would have started with the Intel 8085 microprocessor.

How do you plan to locate the 32 kbyte ROM in the 64 kbyte address space? What address range will your RAM occupy? How much RAM will your single board computer have? How will you map the I/O address space? What kind of peripheral devices will you support? But most important, how will you download a binary image into the ROM?

Yes, you can use an ORG assembler directive, but which relocatable assembler are you going to use? Do you have a PC-based software development system? Which linker/loader will you use to process the assembled code? What hardware will you use to write the linked and re-located code to the ROM? Is the ROM erasable with ultraviolet light? Or are you going to use a flash re-programmable EEPROM? How will you test the board to determine that it is operational? How will you test code you download to the ROM?

You should have the answers to all these questions before you even think about rolling any code.
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
The board will have ram equal to the rom for starters, i had soldered on header pins of the address and data lines for easy expansion later on. i am still reading up on the I/0 control i will most likely be using an intel 8255. I plan to use an willem EPROM/EEPROM programmer to program the ROM. From my understanding of the datasheet the processor handles all the memory mapping, and i am using A15 of the processor to control a not gate, a15 goes directly to the CE pin of the ROM and also to the not gate, when a15 goes high the rom is activated and when it is low the ram is activated, because of this the ram will occupy 0h - 8000h and ROM will occupy 8001h - FFFFh, if i am understanding this correctly. FFF0 is the reset address so i need some code in there to tell the processor to change to an addres further down and that is where the program code will be stored. i have not yet started looking into assemblers to use, do you have any you could recomend? Attached is a picture of a test i just did, i finished wiring in the address bus decoders and the data bus transciever, powered up the board, here is a scope pictures of ALE and and an address pin, this shows the board is opperational and is trying to read code from the rom that is not yet wired in
 

Attachments

  • IMAG2493.jpg
    IMAG2493.jpg
    187.7 KB · Views: 136

hevans1944

Hop - AC8NS
Jun 21, 2012
4,889
Joined
Jun 21, 2012
Messages
4,889
Okay, it appears you know what your are doing. The 8255 was the "go to" device for I/O interface back in the day and, as a plus, supported vectored interrupts if you need those.

When I was involved with Intel 8080 and 8085 microprocessors back in the late 1970s and throughout the 1980s, I had available a full-blown Intel MDS (Microprocessor Development System) complete with an In-Circuit Emulator (ICE) and an EPROM programmer. This turned out to be overkill. The ICE in particular was more trouble than it was worth, so I quickly abandoned it. I worked for an exclusively DEC (Digital Equipment Corporation) shop and most of the engineers and software analysts regarded microprocessors as "toy computers" not worth the effort to pursue. IIRC, I purchased an Intel MACRO cross-assembler that ran on a PDP-11/34 minicomputer under RSX-11M OS. We had perhaps a dozen or so DEC "dumb" video terminals hardwired to the PDP-11. There were several of these minicomputers and a couple VAX-11/780s, but all I needed was the one "general purpose" PDP-11 for program development.

My assembly code generated re-locatable object files that were passed off to a relocatable linker/loader which then generated a loadable-into-memory hex code file in ASCII format. That hex code was then downloaded to an EPROM programmer, which IIRC was part of the Intel MDS, although later I believe I also had a stand-alone programmer. All this communication was through RS-232 comm links because USB didn't exist yet. It took maybe five minutes to program and verify an EPROM and maybe fifteen or twenty minutes to erase several of them under a UV light source, procured for just that purpose. I always had several erased EPROMs in the pipeline. My strategy was to write code, assemble it, link the relocatable object files, download the hex load file to the EPROM programmer, burn an EPROM, and then insert it in the target board for test and debug on the bench using real hardware. This turned out to be more efficient than trying to use the ICE, which IIRC was not only a real kludge to set up and use, but also introduced unacceptable time delays during emulation.

My first 8085 project was inherited from an employee who had to leave because of a perceived conflict of interest between his full-time job and his entrepreneurial side business. His side business was very successful, so he held onto it and left the company with short notice. I was hired about a week before he left, and a year after I graduated with a BEE degree while working full time almost twelve years in a university research institute environment. Not a bad deal: they paid all my tuition. In the last few years at the research institute, I had been busy building and programming embedded 8080 and 8085 microprocessors into various laboratory instruments. I guess the folks who hired me thought that was qualification enough to replace their entrepreneurial engineer.

The engineer I replaced was developing a digital cassette tape controller interface that would accept digitized light-intensity readings from a precision radiometer sensor and record the information on digital cassette tapes. This was to replace an existing system that basically used discrete TTL circuitry and a modem to record audio tones, representing digital data, on audio tape cassettes. That was reminiscent of early Radio Shack TRS-80 recorders and similar schemes in use for personal computers at that time. I think my son's Commodore 64 used such a scheme. It was slow and totally unreliable.

The digital cassette tape recorder used NRZI coding of the magnetic domains on the tape with CRC check-sums at the end of each data block. Data block formatting was the responsibility of the end user (me) so there was a fairly steep learning curve. There were other details regarding tape motion control, optical filter insertion in the light path using solenoid steppers, and an external telephone acoustic modem interface, but that was about the extent of it. The hardest part was programming the digital tape controller interface. Needless to say, this was a real-time data acquisition system by the time I finished it. And nary an operating system in sight.

This was a "field portable" instrument in two parts: a large fiberglass backpack holding lead-acid cells and the electronics; an optical device containing optical filters, mirrors and lenses, the radiometer head, and a mechanism for selecting the angle at which the radiometer "viewed" a target material placed on the ground under it. The customer called these measurements "ground truth" data. Our company laid out huge targets on the ground to measure the resolution and gray-scale response of overhead imaging systems. The crews on the ground went over the targets to measure how much light they reflected during certain times of the day and during certain times of the year, said data being used later to calibrate the overhead imagery data. We always hired some husky local types out in the field to carry the instruments around and take measurements during the day. During the night, back at a local motel, they would connect to an audio modem and send the collected data back. I had to program this protocol too, with error correcting, so as to get good data back over noisy long-distance telephone lines.

I think there are a number of cross-assemblers available, for free now, for Intel microprocessor program development in a Windows or, maybe, Linux environment. You may not even need a re-locatable code assembler, but it sure makes program development easier. At one time IBM published the source code for their DOS BIOS that included an editor and features that allowed insertion of break-points and bit-banging. You might want to consider including some variation of this in your ROM to allow program debugging. With re-locatable code, you can temporarily move some ROM code into RAM and execute it from there with the ability to insert break-points for debugging purposes.

I doubt I can be much help on your project... too many years have passed since I messed around with this technology. I admire your effort to resurrect it.

73 de AC8NS
Hop
 

Allen Bong

Dec 5, 2014
4
Joined
Dec 5, 2014
Messages
4
Looking at the ALE against the CLK on the scope, I know that a new baby computer was born. Do have lots of fun and don't forget to tell us more about how this baby is growing into his adulthood.

I only played with 8088 long ago with the two assembly books written by Peter Norton - "Assembly Language Book for the IBM PC" and "Advanced Assembly Language". AFAIR, they use MASM from microsoft for all the examples.

I might be doing a simple project like yours when if I can locate the 8284 chip. I have a few 8088 sitting there doing nothing. Is the 8288 essential for the SBC or it is just optional? As for the memories I have some 27C512 and 62256 (MCM60L256) that were taken from old equipments.

Which website did you used to set up your hardware or did you designed your own circuits?

I found that the schematics in this link is very similar to yours
http://helmpcb.com/electronics/8088-computer

Allen
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
That is one of the sites i used as a reference along with some small pieces of information from other sites and of course the datasheets, my next step is once i decide on my rom and ram chips to finish wiring them in and then i will try to develope some sort of basic output just to output the databus (maybe 8 LEDs) to ensure the processor is correctly reading instructions from the rom
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
I wanted to add something to ths, Hevans1944 you mentioned about needing a relocatable assembler/linker i did some more reading and from my understanding, wont i actually need an absolute assembler/linker? from my understanding absolute code is where you specify which address instructions are stored at, while relocatable code the assembler decides where to put it
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,889
Joined
Jun 21, 2012
Messages
4,889
An absolute assembler does not produce relocatable code. The output is a binary image you load into memory. You may be able to live with that for simple programs. A linker takes relocatable object code from an assembler and creates a loadable binary image, resolving all relocatable address references in the source code to absolute addresses. That means you don't have to keep track of addresses when writing your source code. It also means you don't need to keep track of where the binary executable gets loaded into ROM or where the data pointers into RAM are resolved. Well, except for the tiny amount of code you place at the memory location addressed after a hardware reset.

You should probably use Microsoft MASM for your program development. I think there is an option to use MASM without a linker.

The 8088 is considerably more sophisticated than earlier 8-bit microprocessors (being essentially a 16-bit 8086 with an 8-bit external data path instead of a 16-bit path) because it has hardware registers that are used to automatically address program, data, stack, and extra segments. If I am not mistaken, the 8088 assembler and linker "takes care" of setting up and using those registers. You will need an ORG directive pointing at 0xFFFF0 to store a JMP instruction for reset. You may need to initialize a segment register too (for the program counter). I don't know if that is an assembler directive or a linker directive.

I have never programmed a 16-bit processor in assembly, other than modifying a few peripheral drivers for DEC's RSX-11M running on PDP-11 computers. That's a character-building experience I care never to repeat. Better to let a software dude do that if you can find one (like you) that understands hardware. I understand it can get real complicated to program in assembly if you want to do multi-tasking. I read the source code for the PDP-11 RT11 OS (a real-time operating system) and was fascinated by how it dispatched tasks and resolved threads that were blocked awaiting I/O completion. It seemed to me at the time (early 1980s) that a lot of CPU time was devoted to OS overhead, but then I didn't really appreciate (yet) just how fast those buggers executed instructions. So anyway we went, in just a few years, from 10 MHz clocks to 3 GHz clocks, from 65 kilobytes of memory to gigabytes... amazing stuff these new-fangled computers, with no end in sight yet.
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
I am installing MASM now, So i would just write ORG 0xFFFF0H then put a jmp 0x8001h then the rest of the code?
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,889
Joined
Jun 21, 2012
Messages
4,889
I am not at all certain whether the ORG directive goes in the assembler or the linker. You probably need at least two ORG directives: one to point to 0xFFFF0, where you put the JMP instruction, and a second to point to 0x8001 where you put the rest of your code. Also check the 8088 docs to see if you need to initialize the program segment register prior to executing the long JMP instruction.

If I have time this week, I will download the latest version of MASM (and the supporting software it needs) from the Microsoft website and take a look at the documentation.

The only thing I have to try it out on is this ancient Pentium 4 that I am using right now. I would have to figure out how to build an .exe file in MASM and load it and execute it from a DOS command-line window running on Windows XP Pro. IIRC, Windows will remain in the loop (it hooks a lot of stuff when it loads), protecting the machine's hardware resources from my "rogue" program. Things were so much easier when programs loaded directly from the DOS >C prompt. You literally "owned" the machine and could do pretty much anything. Anyway, all this on my end is several more steps up the software abstraction tree from where you want to be. I don't know how helpful anything I could do would be.

I think I might be getting too old to farckle with things like this now. Sounds like fun though, and old memories are coming back to life...
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
i am having a really hard time finding any information online about coding for the 8088, i can find alot on writing programs for 8088 powered dos machines, not what i am looking for though and doesnt really help me, i purchased a book called "8088/8086 assembly programming" or something like that hopefully it will cover more of the basics
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,889
Joined
Jun 21, 2012
Messages
4,889
Well, what exactly do you want to use your "new" computer to do?

The 8088 is basically the same as the 8086, but with an 8-bit external data path instead of 16 bits. Both address 1 MB of memory in "real" mode. For "IBM-compatible" PCs, the 8088 was first replaced by the 16-bit 80286 for the IBM-PC/AT, and that was eventually replaced by the 80386 32-bit CPU, which could easily switch back and forth between "real" mode and "protected" mode memory access. Although the 80286 was briefly used in the IBM-PC/AT, it was a 16-bit CPU and could not easily switch back to "real" mode for compatibility with DOS programs. There was a work-around kluge that basically depended on the keyboard interface to get the 80286 to switch to "real" mode without destroying the mapping registers used in "protected" mode. For this and other reasons Bill Gates opined that the 80286 was "brain dead". Eventually "real" mode was more or less abandoned by Microsoft in favor of "protected" mode, which allowed multi-tasking operating systems like Windows 3.0 to be more easily developed. Still, to this day, Windows retains a DOS "real" mode core... at least through Win XP. I don't know about Win 7 or Win 8 or other NT versions of Windows.

But I understand you are not interested in writing an operating system. You just want to have fun with your 8088 piece of history.

There isn't much you can do with an 8086 or an 8088 that isn't already done on a PC motherboard of that era. However, IIRC, some of those mobos had removable ROM-BIOS ICs that you could replace with your own EPROM. That would be a heck of lot easier than building the peripheral hardware you will need for basic input/output functions, but it does violate the spirit of your project. So, I am not suggesting that you do that.:D

IMO most embedded processing of that era, that didn't involve the need for a PC to run word processing or spreadsheet software, could be done inexpensively with an 8-bit micro (like the 8085) for applications that didn't require sophisticated peripherals like video controllers, disk controllers, serial controllers and the like. Of course today we have things like the Arduino and the Raspberry Pi that make it ridiculously cheap and simple for almost anyone to build embedded applications... and (in the case of RPi) with a Linux OS, too, for keyboard, mouse, USB, and video controller support.

Intel added so many new instructions, oriented toward multi-tasking operating systems, in their later processors that I gave up trying to keep up with their instruction sets. I am not a professional programmer; I just dabble in coding. Maybe I will make a stab at understanding the newer RISC processors if I can find an assembler for some of them... and I do like the Texas Instruments line of MSP430-series embedded processors, which are fully supported with software development environments from TI.
 

twenglish1

Feb 21, 2014
24
Joined
Feb 21, 2014
Messages
24
For starters i plan to just do some simple i/o functions just like when i first learned to program microcontrollers, blink leds and read switch states, then eventually i would like to get into writing a simple os that i could interface with over a serial console maybe, but as of now that is way over my head, so i will be sticking to learning the basics first
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,889
Joined
Jun 21, 2012
Messages
4,889
Sounds like a good way to learn about the hardware.

I visited my alma mater yesterday and decided to drop in to the UD Bookstore, just to browse among the new and used text books to see if there was something I might like to study. There was a shelf with texts on operating systems programing, presumably part of a computer science curriculum, but the prices were way beyond my meager means, even as used texts. Nothing less than about $120.00 and some more than $200. Guess I will have to revert to plan B (the library) or plan C (the Internet) if I want to learn more about how to write an OS. Or, being old, I can sign up to audit courses at UD or any Ohio state college or university, such as Wright State University here in Dayton, for free. Still have to pay for the text books though.:(
 
Top