is there an opcode for LDA on the 6502 microprocessor,
and if so, what was the opcode?
LDA by itself does not have an opcode.
the following have opcodes:
and these opcodes are different!!!
- LDA #00
- LDA $01
- LDA $0002
it is important to remember that the mnemonic only has meaning in the
context of what follows it.
lenient marking: 1/2 mark for a wrong answer that was nevertheless
one of the above.
one group referred to LEDs as "bulbs".
does everyone realize that LEDs are diodes (e.g. only light up when correct
TTL can sink more than it can source, therefore reference to +5 rather than
invert in the calling program.
userspace versus kernelspace device drivers: gpm and X are examples of userspace
usleep often used in device drivers.
usleep may keep the CPU busy (waiting loop) in some implementations.
usleep may be dangerous in kernel if interrupts disabled; many times you don't
know whether or not interrupts are disabled.
may cause clock ticks to be lost. however, even chvt can disable
interrupts for up to 1/10 sec causing
clock loss, especially on smaller (e.g. 486) wearcomps.
many times you don't know whether or not interrupts are disabled.
another counter called "jiffy" has timer tick granularity of 100Hz on most
non alpha computers.
1/1024 on alpha (since it has low context switching overhead, even
1/4096 sec was considered).
1/100 sec on others.
HZ returns number of time ticks per second.
fprintf(stderr, "Use: %s usleep long_number_of_microseconds\n",
// if (argc==2) usleep(strtol(argv,(char **)NULL,10));
if (argc==2) usleep(strtol(argv,(char **)NULL,0));
if (argc==3) usleep(strtol(argv,(char **)NULL,strtol(argv,(char **)NULL,0
further additional note:
don't bother trying to tell the compiler exactly what to do; instead focus
on making your code easy to read.
for example "register int x = 5"
gcc ignores the "register" directive.
x=x/2 is no worse than x=x>>1
x=x/4 is no worse than x=x>>2
when x is an unsigned integer.
a note on portability and the merits of kernelspace device drivers:
inb and outb are macros.
inb and outb expand to assembly language commands inb and outb on x86.
inb and outb expand to memory references on SA1100, therefore won't work
from userspace because (recall that) USERSPACE SEES MEMORY AS VIRTUALIZED.