Docsity

COAL Study Notes (Computer Organization & Assembly Language), Summaries of Computer Architecture and Organization

Toggle sidebar
bg1
COAL NOTES By AK
= directive:
1. Can be redefined
2. When re-defined it will only change things that are initialized after it not above it.
3. Can hold only up to 32 bits of data either number or strings
Equ directive:
1. Can’t redefine numbers or expressions
2. Can redefine strings only with same previous data otherwise it will be considered error.
3. No limit of 32 bits
TextEqu directive:
1. Can be redefined for numbers or strings
2. No limit of 32 bits
Type command: tells us the about type e.g. byte (1), word (2), dword (4), etc.
Lengthof command: tell us about the number of elements.
Sizeof command: tell about the total number of bytes a label takes. (Explicit Formula: type * lengthof)
LAHF stores lower 16 bits EFLAG register into ah register
SAHF stores ah into flag register lower 16 bits.
Carry Flag: unsigned numbers
Overflow Flag: signed numbers
(Shortcut: Cute OS)
GLS-BUS: greater lesser for signed - below for unsigned
pf3
pf4
pf5

Partial preview of the text

Download COAL Study Notes (Computer Organization & Assembly Language) and more Summaries Computer Architecture and Organization in PDF only on Docsity!

COAL NOTES By AK

= directive:

  1. Can be redefined
  2. When re-defined it will only change things that are initialized after it not above it.
  3. Can hold only up to 32 bits of data either number or strings Equ directive:
  4. Can’t redefine numbers or expressions
  5. Can redefine strings only with same previous data otherwise it will be considered error.
  6. No limit of 32 bits TextEqu directive:
  7. Can be redefined for numbers or strings
  8. No limit of 32 bits Type command: tells us the about type e.g. byte (1), word (2), dword (4), etc. Lengthof command: tell us about the number of elements. Sizeof command: tell about the total number of bytes a label takes. (Explicit Formula: type * lengthof) LAHF stores lower 16 bits EFLAG register into ah register SAHF stores ah into flag register lower 16 bits. Carry Flag: unsigned numbers Overflow Flag: signed numbers (Shortcut: Cute OS) GLS-BUS: greater lesser for signed - below for unsigned

AND: used for masking (updates zero and parity flag and the current register value(al) ) Test: same as AND command but doesn’t update current register value (al) XOR: used to check parity of a number if a register is XOR with 0 is tells the parity of that number if we XOR two number together it will tell the parity of both numbers combined. Rotate carry then check edge cases by rotating on ax then on al then see how it updates PUSH POP: PUSH A: pushes 16 bit registers to stack (order: ax cx dx bx sp bp si di) POP A: pops all 16 bit register in back to the register. PUSH AD: pushes 32 bit register to stack POP AD: pops 32 bits register to original registers PUSHF: pushes 16 bit flag register to stack PUSHFD: pushes 32 bit flag register to stack Ret --> pops ret address then moves to program Ret 4 --> pops ret address and also pops 4 bytes of memory from stack SHIFTS and Registers: SHL: multiplies by 2 and simply shifts to left side and for only that specific register no affect in its vicinity like shl al,10 will have no shifting from al to ah even the shift size increases. (has affect on carry flag) but carry bit doesn’t move into registers same for shr

Cdq: convert double to quad then eax:edx CACHE: C --> cache size B -->no of block b --> block size C = b* B S --> sets S = B/N ; N = associativity level direct mapping 1, associativity 2 Offset bits = log 2 (b) = number of offset bits Set bits/line bits = log 2 (S) = number of set bits Tag bits = total address bits - offset bits - set bits

Coal Lab Notes:

1. Without IRVINE CODE . .model flat, stdcall .stack 4096 ; WINAPI declaration GetStdHandle PROTO, a2:dword WriteConsoleA PROTO, a1:dword, a2: ptr byte, a3:dword, a4:ptr dword, a5:dword ReadConsoleA PROTO, a1:dword, a2: ptr byte, a3:dword, a4:ptr dword, a5:dword .data ; declarations here .code ; functions here Main PROC ; main code here Main ENDP

;functions here END main

2. Irvine CODE include irvine32.inc .data msg db "Lab section c 09" readmsg db 255 dup(?) .code main proc mov edx,offset msg call writestring call crlf mov edx,offset readmsg mov ecx, ;call readstring call readint call writeint main endp end main

Irvine Setup:

Total steps to set up an Empty C++ Project to a COAL project

  1. Open a new empty C++ project.
  2. Delete the Source Files, Resource files and Header Files in solution Explorer
  3. Right click on project name and then select Build dependencies and select Masm
  4. Right click on project name, Add new item name source.asm
  5. Right click on source.asm and in properties, open the drop down of Item type and select Microsoft macro Assembler.
  6. On top ribbon infront of debug select ×86. (simple COAL project is ready) Setting Irvine
  7. Copy the path of the irvine library