Cos 365 Practical Microsoft Assembler
Course Details Lecturer: Dr Venter Lecturer: Dr Venter Prac Assistant: Kelvin Andrews Prac Assistant: Kelvin Andrews Assembly Language (Intro) Assembly Language (Intro) Maths Lab ->Level 2 Science Building Maths Lab ->Level 2 Science Building 6 Practicals 6 Practicals Due dates: week from receiving prac Due dates: week from receiving prac Consultation times Consultation times
Course Materials Microsoft Assembler Compiler Microsoft Assembler Compiler Irvine Library Irvine Library Prescribed Textbook Kip R. Irvine Prescribed Textbook Kip R. Irvine Online ebooks Online ebooks Assembly Editor Assembly Editor
Numbers System Decimal Decimal Binary Binary Hexadecimal Hexadecimal Byte Byte Bit Bit
CPU Registers Intel family of 8088/80286/80386 Intel family of 8088/80286/80386 Processor registers Processor registers Low level assembly Low level assembly
Intel 8088 registers AX – AH, ALPrimary Accumulator AX – AH, ALPrimary Accumulator BX – AH,BLArithmetic, pointers BX – AH,BLArithmetic, pointers CX – CH,CLLoops CX – CH,CLLoops DX – DH,DLMultiplication, division DX – DH,DLMultiplication, division
Cont.. ‘pointer’ registers SISource pointer for string ops SISource pointer for string ops DIDestination pointer for string ops DIDestination pointer for string ops BPBase pointer BPBase pointer SPStack pointer SPStack pointer
Cont.. ‘segment’ registers CSCode segment CSCode segment DSData segment DSData segment SSStack segment SSStack segment ESExtra segment ESExtra segment
Cont.. ‘special’ registers IPProgram counter IPProgram counter FLAGSProgram status word FLAGSProgram status word
FLAGS register Overflow Overflow Direction Direction Interrupt Interrupt Trap Trap Sign Sign Zero Zero Auxiliary Auxiliary Parity Parity Carry Carry UnusedODITSZAPC
Register sizes 32bit16bit8bit8bit EAXAXAHAL Why do I care about sizes?
Variables Sizes not type matter Sizes not type matter DB1byte DB1byte DW2bytes DW2bytes DD4bytes DD4bytes DQ8bytes DQ8bytes –samplearraydw 0,1,2,3,4 –promptdb ‘Enter your name?’ –forty40 dup(?) –jdb 20 –numdw 4000 –longnumdd 80000
Directives Model Model Stack Stack Data Data Code Code Denote by a ‘.’ Denote by a ‘.’ –.model small –.stack 100h
Assembler statement format Label field Operation field Operands field Comments field formul.mov AX, I ;Load I into AX AX – destination I – target eg startmove. mov bh, 20 ; load 20 into bh reg
Practical Assignment READING is underrated! Follow the instructions on the prac-sheet Code your 1st assembly program If you get stuck, ask a friend… Still having problems, try Kelvin or Dr Venter