Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Exercise from: http://i46.tinypic.com/2whm49u.jpg
- org 400h
- disp equ 0h ;Interrupts every 30 seconds and interruption programs DMAC
- dmac equ 1h ;DMAC, acquires 512B from an external drive and stores them in #buffer
- car equ 2h ;DMAC's current address register
- wc equ 3h ;DMAC's word counter
- buffer equ 0BCBCh ;Memory buffer starting address
- datac equ 0CCh ;Binary number 11001100, if present less than 11 times in buffer disp is masked
- code
- jsr init
- seti
- main: jmp main ;Loops until interrupt
- halt
- init: inl #30, disp ;Sets counter to 30 seconds and starts disp
- start disp
- ret
- driver 0, 700h ;Display driver
- push R0
- movl #512, R0
- outl R0, wc ;Sets word counter to 512
- movl #0BCBCh, R0
- outl R0, car ;Sets initial memory location to buffer
- start dmac
- pop R0
- rti
- driver 1, 900h ;DMAC driver
- push R0
- push R1
- push R2
- push R3
- movl #512, R0 ;Serves as word counter
- movl #0BCBCh, R1 ;Serves as current address register
- movb #0CCh, R2 ;Stores data to compare
- xorl R3, R3 ;Serves as counter, stores how many times the word is found in memory
- find: cmpb (R1)+, R2 ;Compares data contained in memory with data to find
- jnz notfound
- addl #1, R3 ;Adds to the counter when the data is found
- notfound: subl #1, R0 ;Updates word counter
- jz exit ;Exits when counter hits zero
- jmp find
- exit: cmpl #10, R3
- jz ok ;If data appears 10 times, deactivates disp
- jnn skip ;If data appears more than 10 times, deactivation is skipped
- ok: clear disp
- skip: pop R3 ;Returns from subroutine
- pop R2
- pop R1
- pop R0
- rti
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement