- Assembly language was designed for people who are systems level programmers.
C was designed for people who think they are systems level programmers.
FORTRAN was designed for engineers who think they are programmers.
COBOL was designed for business managers who think they are programmers.
BASIC was designed for everyone else who thinks they are programmers.
C++ was designed for people who think Bill Gates invented the computer.
A comment that says "decrement the X register" isn't helpful, and in reality is redundant—instruction mnemonics tell the programmer what they do. What is needed is a comment telling the reader why the X-register is being decremented. The reader can always crack open an assembly language manual to find out what the DEX instruction does. The program comments should be telling the reader what is going on, not what the assembly language statements mean. In other words, comments should be explaining what is being processed and how, not what the microprocessor is doing.
In more than a few of my programs, I may have many lines of commentary explaining what a subroutine is supposed to do, what kind of data it is processing, errors that may be generated. At the very least, there will be information about preliminary steps to carry out before calling the function, how the registers will be affected, and what error returns might come back. For example:
Code: Select all
;scsicmd: EXECUTE SCSI COMMAND
;
; ————————————————————————————————————————————————————————————————————————
; Preparatory Op: GPPTR must be set to the 24-bit address of the buffer
; that is to be accessed during the data in & data out
; phases. (1)
;
; Call registers: .A: target device SCSI ID
; .X: CDB address LSW
; .Y: CDB address MSW
;
; Exit Registers: .A: exit code (2)
; .B: $00
; .X: used
; .Y: used
; DB: entry value
; DP: entry value
; PB: entry value
;
; MPU Flags: NVmxDIZC
; ||||||||
; |||||||+———> 0: okay (2)
; ||||||| 1: exception (3)
; ||||||+————> reflects exit code
; ||||++—————> 0
; ||++———————> 1
; ++—————————> undefined
;
; Notes: 1) The buffer address is a "don't care" if the command to be
; executed doesn't return any data to the caller, other than an
; error code.
;
; 2) See 'include/error.asm' for the list of possible SCSI subsys-
; tem errors.
; ———————————————————————————————————————————————————————————————————————