6-m - LD R7, REG7_LY RET ; Storage for saving registers...

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

View Full Document Right Arrow Icon
24 Daily Quiz • Write a subroutine LINE_Y to calculate y = mx + b – x is passed to routine in R0 – return y in R0 – m and b are at memory locations with labels SLOPE, X_INT – you have a routine MULTIPLY available (within 1024 words) which multiplies the values in R1 and R0, returning result in R0 – Preserve all registers (except of course R0)
Background image of page 1

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

View Full DocumentRight Arrow Icon
25 Daily Quiz – Possible Answer LINE_Y ; Save registers ST R1, REG1_LY ST R7, REG7_LY LD R1, SLOPE ; R0 = x, R1 = m JSR MULTIPLY ; R0 = m*x LD R1, X_INT ; R1 = b ADD R0, R0, R1 ; R0 = m*x + b ; Restore registers and return LD R1, REG1_LY
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: LD R7, REG7_LY RET ; Storage for saving registers REG1_LY .BLKW 1 REG7_LY .BLKW 1 Fixed labels 42 Output Service Routine ; R0 - contains the ASCII code of the character ; to be displayed on the monitor START LDI R1, DSR_ADDR ; Test if output BRzp START ; register ready STI R0, DDR_ADDR BR NEXT_TASK ; do what comes next DSR_ADDR .FILL xFE04 ; Address of DSR DDR_ADDR .FILL xFE06 ; Address of DDR DSR (0xFE04) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 1 1 DDR (0xFE06) Fixed labels...
View Full Document

Page1 / 3

6-m - LD R7, REG7_LY RET ; Storage for saving registers...

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

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