ASSEMBLY LANGUAGE EXAMPLES |
|||
---|---|---|---|
Example 1 |
|||
LD HL, 22528 | 210058 | Start of the attributes |
|
LD DE, 30100 | 119475 | Storage byte |
|
LD A, 22 | 3E16 | Loop counter |
|
ONE |
LD (DE), A | 12 | Stored at 30100 |
LD B, 32 | 0620 | Column counter |
|
TWO |
LD (HL), 127 | 367F | Attribute value |
INC HL | 23 | placed in row |
|
DJNZ TWO | 10FB | ||
LD A, (DE) | 1A | Recover loop counter |
|
LD B, A | 47 | Copy in B |
|
DEC A | 3D | Loop counter minus one |
|
LD (DE), A | 12 | Replace loop counter |
|
DJNZ ONE | 10F3 | Jump back to ONE |
|
RET | C9 | unless all done |
|
Example 2 |
|||
This is the same as 1 except for the first three lines |
|||
LD HL, 16384 | 210040 | Start of display file |
|
LD DE, 30100 | 119475 | Storage byte |
|
LD A, 200 | 3EC8 | Loop counter |
|
Example 3 |
|||
LD HL, 22528 | 210058 | Start of the attributes |
|
LD DE, 30100 | 119475 | Storage byte |
|
LD A, 6 | 3E06 | First loop counter |
|
LD (DE), A | 12 | stored |
|
LD A, 0 | 3E00 | Attribute value |
|
LD (30101), A | 329575 | stored |
|
ONE | LD A, (30101) | 3A9575 | Recover attribute value |
LD B, 128 | 0680 | Loop counter |
|
TWO | LD (HL), A | 77 | Place attribute in file |
INC HL | 23 | next position |
|
DJNZ TWO | 10FC | until 128 done |
|
LD B, 8 | 0608 | Add eight |
|
TRE | INC A | 3C | to attribute value |
DJNZ TRE | 10FD | ||
LD (30101), A | 329575 | Store new value |
|
LD A, (DE) | 1A | Recover counter |
|
LD B, A | 47 | Copy into B |
|
DEC A | 3D | Counter minus one |
|
LD (DE), A | 12 | Store new counter value |
|
DJNZ ONE | 10EB | Jump back to ONE |
|
RET | C9 | unless B = 0 |