Coding in assembly is brutal.
Assembly languages rely even more on pointers (through address registers) so you can't even rely on the compiler or static analyzing tools to warn you about such memory corruptions / buffer overruns as opposed to C.
For instance in C, a good compiler may issue a warning there:
x = 'c';
When calling the mouse driver interrupt with AX = 0, it returns 0xFFFF in AX if a mouse driver is installed.
So if it is installed, the code with INC AX will increment AX back to 0 and then it will just reset the mouse driver a second time.
It is very typical that interfaces that use software interrupts give you back a status code in AL or AX, so this is no ...
All of them. But it will only have an effect with a select few.
Contrary to what the question implies, the rep prefix is not an orthogonal looping construct that can be combined with any instruction. The 8086 family manual defines the use of rep/repe/repz (0xf3) and repne/repnz (0xf2) prefixes only in conjunction with string instructions, which are movs, ...
Calling an interrupt service is more like invoking a system call than it is like writing to a memory-mapped register.
That is, when you invoke a software interrupt, there is no guarantee that the register values will be the same that they have been before the interrupt call. In fact, most of the time, they will not be, unless the interrupt service routine ...
The standard way would be adding it to HL. After clearing HL that is.
This is not only already available with the 8080,
DAD SP ; Same opcode (39h), same workings
thus preferable, but as well very handy when setting up a pointer to parameters on stack as, of course, any other constant than 0 can be used and added.
I spent most of my career writing assembler, solo, small teams and large teams (Cray, SGI, Sun, Oracle). I worked on embedded systems, OS, VMs, and bootstrap loaders. Memory corruption was seldom if ever a problem. We hired sharp people, and the ones that failed were managed into different jobs more appropriate to their skills.
We also tested fanatically - ...
I managed to find the exact same three photos Stroustrup used in his slide:
Simula: Kristen Nygaard, who co-designed Simula with Ole-Johan Dahl;
Fortran: John Backus, who headed the team that developed Fortran;
Assembler: David John Wheeler, who worked on what would today be called a relocating assembler for the EDSAC, an early programmable computer (paper),...
Protecting 6502 decimal mode code from interrupts
Decimal mode does not need to be protected from interrupts.
Decimal mode is not cancelled/changed by interrupt routines(*1).
Decimal mode is recorded in a status register flag (SED/CLD)
When entering an interrupt, the status register is pushed on the stack
When leaving an interrupt it is pulled back
The TLE instruction is a modification of the TLU instruction.
TLU (Table LookUp) (Opcode 84) compared a word with a series of consecutive words on the drum and finished as soon as an entry was found being equal or higher. It was meant to find a point in a sorted list.
TLE (Table Lookup Equal) (Opcode 63) is a modification of TLU stopping only when equal, ...
I'm going to say "No" simply because the 8086 doesn't support the alternate registers of the Z80. That was a fairly important concept that you can not directly mimic on the 8086.
Mind, if you're willing to dedicate memory and whatnot to support it, then, "sure". Replace the Z80 functionality with a macro, say. But now you're stretching it....
Simple idiotic errors abound in assembly, no matter how careful you are. It turns out that even stupid compilers for poorly-defined high level languages (like C) constrain a huge range of possible errors as semantically or syntactically invalid. A mistake with a single extra or forgotten keystroke is far more likely to refuse to compile than it is to ...
The difference is that the latter appeared in DOS 2.0.
MS-DOS 1.x was pretty much a rebranded version of Seattle Computer Products’ 86-DOS (initially named QDOS), which in turn was heavily inspired by CP/M. One of the design goals of 86-DOS has been to maintain a certain level of compatibility with CP/M-80: specifically, to be able to port CP/M software to ...
I wrote the original garbage collector for MDL, a Lisp like language, back in 1971-72. It was quite a challenge for me back then. It was written in MIDAS, an assembler for the PDP-10 running ITS.
Avoiding memory corruption was the name of the game in that project. The entire team had dread of a successful demo crashing and burning when the garbage ...
Simply because SRA C doesn't shift A by the content of C, but shifts C right by one with keeping bit 7 (sign) static.
Z80 and shifting:
While the Z80 did add some nice new shifts and rotates, like the mentioned Shift Left Arithmetic for all 7 registers and memory, it still only shifts by one bit position per execution. So any shift by more than one ...
Since the inline assembler of cc65 doesn't accept anonymous labels (from my other answer), another approach is to provide a unique suffix to the labels, which can be applied by the macro. The stringizing operator of the C preprocessor, and the fact that C string literals written consecutively are automatically concatenated, might make this more convenient:
Since it's two questions, here are two answers:
It's a very BASIC 65xx to x80 transition error: Index Registers
Where 65xx CPUs use a 16 it base address (from memory) and an 8 bit index (from register), the x80s use 16 bit index register(s) and an (optional) 8 bit offset. The address of msg should be loaded into IY first (LD IY,msg) and then ...
The V1 Unix B manpage uses .s as the extension for intermediate assembly files used during the build. This is the earliest use of .s that I can find, and would correspond to November 1971 at the latest.
There were assemblers on systems with file systems before Unix, but none that I’m aware of used .s. Some like DECsys don’t appear to have extensions; other ...
On the 8088 and 8086, execution involves two parallel processes--memory access and internal computation--and will be limited by the speed of whichever is slower. Generally, on the 8088 execution speed will be limited by memory access, while the 8086 will be better balanced. Every memory cycle on the 8088 or 8086 takes a minimum of four cycles, and on most ...
The problem with Z80ASM specifically is that it takes the assembly input and spits out a static binary file. This is good and bad.
In "normal" systems, address assignment is, inevitably, the responsibility of the linker, not the assembler. But assemblers are simple enough that many skip that aspect of the build cycle.
Since Z80ASM spits out literal ...
The Japanese children's book The Stars of Famicom Games includes pictures of Super Mario Brothers 3 development for the NES/Famicom. Code was written on an HP 64000 Logic Development System and cross assembled. See also: NES (Famicom) Development Kit Hardware
You can't repeat arbitrary instructions with rep.
In asm syntax, rep just means to include an F3 byte as a prefix for this instruction. There is no implication that it actually means repeat, it's just shorthand for db 0xF3. Assemblers exist to help you put the bytes you want into an object file. It's up to you to make good choices.
When F3 rep doesn't ...
The 1955 manual for the IBM 704 on page 7 talks about data representation in the computer.
When a word is interpreted as numerical data, the
zero position acts as the sign of the word. (…) When
a logical operation is performed on a word, the
word is interpreted as a 32-bit signless number.
As an algebraic (signed) binary number, a word can
If I was to write an Amiga game, what would be the best/most reliable way to detect how much RAM is actually available?
The routine you're quoting is only able to detect chip memory (not fast memory), by hardware banging in certain areas. Games sometimes tried $C00000 (popular slow memory location) in the same fashion. But there are too many fast memory ...
My question is, why did they use an LD B, B instruction, and not a proper NOP?
LD B,B works like a NOP - at least as stated in the original 8080 manual (*1):
The original 8080 had 8 NOPs at 00xxx000 but only the first was defined as 'the nop'. In addition there were 7 instructions of loading a register with itself (*2). Effective NOPs, but not defined as ...
Without reading the manuals it seems that both vasm and tasm decides if an operand is a number or a label is decided from the first character. A number MUST start with a digit in the decimal range, anything starting with a letter is considered a label. So you need to enter the number as '0A000H'.
So, when tasm finds an argument A000H it thinks it a label ...
What is the canonical solution for this type of problem?
There isn't any canonical solution, but many variants, all to be found usable.
The only one that comes to my mind is to create a "jump table" at the beginning
Which is a perfect good one. Except, usually one would use jumps instead of calls to reduce code length, speed up execution, and ...
I am afraid that the answer is "it could take any time, depending on circumstances and the real WAIT condition". WAIT states have unpredictable length, so there is no exact way to answer your question.
The general answer, theoreticaly valid for every CPU (and really valid for the most of 8bit CPUs), is:
Take an "instruction timing chart" ...
Yes, maybe, in a way. It depends on how you define “IBM assembly language”. If it must be officially produced and distributed by IBM, then this isn't an answer, but if the sole criterion is that it is an assembly language for an IBM computer, then the answer is definitely yes.
The IBM 650 had an assembler called SOAP, for Symbolic Optimum Assembly Program. ...
In the first case, I do not encounter any problem in the rest of my program.
That's because you are calling into ROM routines which set up everything for you.
In the second case I notice significant display problems, in particular if the display was in 80 columns before, and if the COUT routine is used after.
Well, you only switched the hardware. You didn'...