HW4soln-3750

HW4soln-3750 - EE 3750 HW 4 solutions 1 EE 3750 Homework 4...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE 3750 — HW 4 solutions 1 EE 3750 — Homework 4 solutions Spring 2006 1. Write an 8086 instruction sequence to use program-controlled I/O to input bytes and store all those received in the string between ‘{‘ (7BH) and ‘}’ (7DH) into a buffer in memory. Let INDEV denote the input device. The status port for INDEV is a byte port at address 34C8H; bit 7 is the ready bit. The data port for INDEV is a byte port at address 34C9H. Let RED denote the byte array (buffer) in memory. (That is, if the sequence of bytes input is: 23, 56, 7B, 36, 3E, 5F, 10, 7D, 39, then store 36, 3E, 5F, 10 into the buffer.) DEVSTAT EQU 34C8H ; will use labels instead of port addresses to DEVDATA EQU 34C9H ; make program more readable DEVRDY EQU 10000000B The instruction sequence will call the following procedure to perform a program-controlled input from INDEV, returning the byte of input data in register AL. READIN PROC NEAR PUSH DX MOV DX, DEVSTAT ; use DX because port address is longer than 8 bits CHECK: IN AL, DX TEST AL, DEVRDY ; poll ready bit JZ CHECK MOV DX, DEVDATA IN AL, DX ; return input byte in AL POP DX ; don’t push and pop AX because using AL to return RET READIN ENDP The instruction sequence now follows. BEFORE: CALL READIN CMP AL, 7BH JNE BEFORE ; discard input data up through ‘{‘ MOV SI, 0 ; pointer into RED DURING: CALL READIN CMP AL, 7DH JE AFTER ; exit once ‘}’ found MOV RED[SI], AL ; store data between ‘{‘ and ‘}’ INC SI JMP DURING AFTER: 2. Write an 8086 instruction sequence to control a copy machine that charges 10¢ per copy and accepts only dimes. Use program-controlled I/O.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

HW4soln-3750 - EE 3750 HW 4 solutions 1 EE 3750 Homework 4...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online