php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cs401 assignment no 4 idea solution on 3rd of January
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#2
SOLUTION:

001 ; elementary multitasking of two threads

002 [org 0x0100]

003 jmp start

004

005 ; ax,bx,ip,cs,flags storage area

006 taskstates: dw 0, 0, 0, 0, 0 ; task0 regs

007 dw 0, 0, 0, 0, 0 ; task1 regs

008 dw 0, 0, 0, 0, 0 ; task2 regs

009

010 current: db 0 ; index of current task

011 chars: db ‘\|/-’ ; shapes to form a bar

012

013 ; one task to be multitasked

014 taskone: mov al, [chars+bx] ; read the next shape

015 mov [es:0], al ; write at top left of screen

016 inc bx ; increment to next shape

017 and bx, 3 ; taking modulus by 4

018 jmp taskone ; infinite task

019

020 ; second task to be multitasked

021 tasktwo: mov al, [chars+bx] ; read the next shape

022 mov [es:158], al ; write at top right of screen

023 inc bx ; increment to next shape

024 and bx, 3 ; taking modulus by 4

025 jmp tasktwo ; infinite task

026

027 ; timer interrupt service routine

028 timer: push ax

029 push bx

030

031 mov bl, [cs:current] ; read index of current task

032 mov ax, 10 ; space used by one task

033 mul bl ; multiply to get start of task

034 mov bx, ax ; load start of task in bx

035 vusolutions .com

036 pop ax ; read original value of bx

037 mov [cs:taskstates+bx+2], ax ; space for current task

038 pop ax ; read original value of ax

039 mov [cs:taskstates+bx+0], ax ; space for current task

040 pop ax ; read original value of ip

041 mov [cs:taskstates+bx+4], ax ; space for current task

042 pop ax ; read original value of cs

043 mov [cs:taskstates+bx+6], ax ; space for current task

044 pop ax ; read original value of flags

045 mov [cs:taskstates+bx+8], ax ; space for current task

046

047 inc byte [cs:current] ; update current task index

048 cmp byte [cs:current], 3 ; is task index out of range

049 jne skipreset ; no, proceed

050 mov byte [cs:current], 0 ; yes, reset to task 0

051

052 skipreset: mov bl, [cs:current] ; read index of current task

053 mov ax, 10 ; space used by one task

054 mul bl ; multiply to get start of task

055 mov bx, ax ; load start of task in bx

056

057 mov al, 0×20

058 out 0×20, al ; send EOI to PIC

059

060 push word [cs:taskstates+bx+8] ; flags of new task

061 push word [cs:taskstates+bx+6] ; cs of new task

062 push word [cs:taskstates+bx+4] ; ip of new task

063 mov ax, [cs:taskstates+bx+0] ; ax of new task

064 mov bx, [cs:taskstates+bx+2] ; bx of new task

065 iret ; return to new task

066

067 start: mov word [taskstates+10+4], taskone ; initialize ip

068 mov [taskstates+10+6], cs ; initialize cs

069 mov word [taskstates+10+8], 0×0200 ; initialize flags

070 mov word [taskstates+20+4], tasktwo ; initialize ip

071 mov [taskstates+20+6], cs ; initialize cs

072 mov word [taskstates+20+8], 0×0200 ; initialize flags

073 mov word [current], 0 ; set current task index

074

075 xor ax, ax

076 mov es, ax ; point es to IVT base

077 cli

078 mov word [es:8*4], timer

079 mov [es:8*4+2], cs ; hook timer interrupt

080 mov ax, 0xb800

081 mov es, ax ; point es to video base

082 xor bx, bx ; initialize bx for tasks

083 sti

084



0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Messages In This Thread
cs401 assignment no 4 idea solution on 3rd of January - by Vuhelper - 01-08-2012, 09:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  cs506 web development assignment no 4 idea solution on 3rd January 2012 rabeel 14 6,837 01-09-2013, 02:41 PM
Last Post: Vuhelper
  need solution of assignemt 601 shahbaz_abbasi 1 2,543 04-19-2012, 09:40 PM
Last Post: Xpert
  sta301 assignment no 1 idea solution spring 2012 Xpert 0 3,819 04-06-2012, 07:55 PM
Last Post: Xpert
  CS604- Operating System assignment no 1 spring 2012 idea solution Xpert 0 3,606 04-06-2012, 07:49 PM
Last Post: Xpert
  cs615 Software Project Management assignment no 1 spring 2012 idea solution Xpert 0 3,165 04-06-2012, 07:45 PM
Last Post: Xpert
  Software Engineering-2 (CS605) assignment no 1 on 6th April 2012 Xpert 0 2,792 04-06-2012, 07:40 PM
Last Post: Xpert
  cs614 dataware house assignment no 4 solution fall 2012 rabeel 1 3,022 01-10-2012, 07:51 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support