Memory GaphicLearning a computer language

by Matthew Leitch, 25 October 2001

The main knowledge structure for learning a computer language is the condition → action pair. You need to notice what it is possible to do with the various commands, operators, etc and in what situations, and what you have to type/do to get those results.

Modern languages are so large that it is unrealistic to try to learn all the commands straight away, so start with the things that are often needed, and move onto the less common techniques later. Not everything is a condition -> action pair. Start with the lowest level of simple task and build them up into larger chunks.

Example: HTML. With HTML the earliest points to note (for someone with some knowledge of programming and computers already) might be along these lines:

It's very important to notice the differences between conditions, and to build up conditions and actions patiently by chunking and chunking again if they are complex.

Example: Word processing. In the mid 1980s I had to learn to use the leading word processing package of the day, WordStar, without access to a computer. I bought a small book about how it worked and identified and learned the condition -> action pairs. I reinforced them by writing the conditions on one side of small cards and the actions on the other. I could shuffle these cards and test my memory by reading the condition and trying to recall what keys to press. After doing this I finally got access to a computer for an hour. After 50 minutes on the computer I had done everything the package could do and found it all as I expected, even mail-merge. The next time I used the software was in a test of my skill organised by a potential employer who concluded that I knew it "standing on my head". The next time I used it I was paid. I don't recommend learning with cards if you have the software itself available for practice, but this example shows that the right memory structure, diligently built, will give you a usable skill and that this is more important than realistic practice.

Identifying the condition part is not always straightforward. With computer languages it is often possible to break down the conditions in a structured list and take notes that show the breakdown. This helps clarify what each condition is, but the list should not be learned as a list.

Example: The 8086 assembly language command set. This long-obsolete chip had a command set small enough to be a convenient example of the systematic breakdown of conditions and the style of note taking that can be used. It is rare to be able to do a comprehensive analysis like this, and even this example is only the lowest level of condition → action pairs. Higher level pairs would build the skill of doing larger, more meaningful tasks. If this seems complicated to you, don't worry. Anyone who has ever mastered assembly language programming has mastered this information, and worse, and probably picked it up in a more muddled way.


         from a to b
            general purpose : MOV
            load offset and segment
               with load to DS : LDS
               with load to ES : LES
            load offset : LEA
            using [AL]+[BX] : XLAT
         swapping between two locations : XCHG
         to and from stack
               pushing : PUSH
               popping : POP
            with flags
               to stack : PUSHF
               from stack : POPF
         involving flags
            to and from stack
               to stack : PUSHF
               from stack : POPF
            between AH and 8080 flags
               AH to 8080 flags : SAHF
               8080 flags to AH : LAHF
         data movement
            just memory : MOVS
            memory and AX/AL
               load from memory to AX/AL : LODS
               store from AX/AL to memory : STOS
         data comparison
            compare AX/AL with memory : SCAS
            compare memory with memory : CMPS
         input : IN
         output : OUT
         related to addition
               including carry : ADC
               not including carry
                  general : ADD
                  add 1 : INC
               ASCII : AAA
               decimal : DAA
         related to subtraction
               including carry : SBB
               not including carry 
                  general : SUB
                  subtract 1 : DEC
                  2s complement : NEG
               ASCII : AAS
               decimal : DAS
         related to multiplication
               signed : IMUL
               unsigned : MUL
               ASCII : AAM
         related to division
               signed : IDIV
               unsigned : DIV
               ASCII : AAD
            sign extension
               8 -> 16b : CBW
               16 -> 32b : CWD
         logical NOT : NOT
         logical ANDs
            with usual alteration of operands : AND
            without alteration of operands : TEST
         logical ORs
            logical OR : OR
            logical XOR : XOR
            through carry
               left : RCL
               right : RCR
            not through carry
               left : ROL
               right : ROR
            left : SAL, SHL
               preserve sign : SAR
               not preserve sign : SHR

         with carry status
            clear carry : CLC
            set carry : STC
            complement carry : CMC
         with interrupt status
            clear interrupt enable : CLI
            set interrupt enable : STI
         with direction flag
            clear direction flag : CLD
            set direction flag : STD

            calling : CALL
            returning : RET
            causing interrupts
               unconditional interrupt : INT
               interrupt on overflow : INTO
            returning from interrupt routines : IRET
            unconditional jump : JMP
            jump on condition 
               single condition
                  on carry flag 
                     = 1 : JB, JC
                     = 0 : JAE, JNC
                  on overflow
                        = 1 : JO
                        = 0 : JNO
                     relative to sign
                        equal : JGE, JNL
                        <> : JL, JNGE
                  on parity
                     = 1 : JP, JPE
                     = 0 : JNP, JPO
                  on zero
                     = 1 : JE, JZ
                     = 0 : JNE, JNZ
                  on sign
                     = 1 : JS
                     = 0 : JNS
                  on CX = 0 : JCXZ
               multiple conditions
                     carry = zero = 0 : JA, JNBE
                     Zero=0, Sign=Overflow : JLE, JNG, JLE, JNG
                     carry|zero = 1 : JBE, JNA
            using prefix : REP
            using LOOPs to decrement CX and test
               if CX = 0 : LOOP
               if CX <> 0
                  and Zero flag = 1 : LOOPE, LOOPZ
                  and Zero flag = 0 : LOOPNE, LOOPNZ
               unconditional no operation : NOP
               no operation on mod = 11 : ESC
            hang ups
               enter wait state : WAIT
               enter halt state : HLT
            grab control of bus for 8086 : LOCK
© 2001 Matthew Leitch