Difference between revisions of "Locate OS"
From WikiPrizm
Jump to navigationJump to searchLine 5: | Line 5: | ||
| header = fxcg/display.h | | header = fxcg/display.h | ||
| synopsis = Sets the cursor position for [[Print_OS]]. | | synopsis = Sets the cursor position for [[Print_OS]]. | ||
+ | | parameters = * '''x''' Must be in range of [1,21] | ||
+ | * '''y''' Must be in range of [1,8] | ||
+ | | comments = This function does bounds checking and will do nothing if x or y are out of range. | ||
+ | <nowiki> | ||
+ | locate_OS: | ||
+ | mov #1, r2 | ||
+ | cmp/ge r2, r4 ! Is r4 >= 1? If so set T=1 | ||
+ | bf locate_OS_exit ! If R4 is less than one do not set the cursor position | ||
+ | mov #21, r6 | ||
+ | cmp/gt r6, r4 | ||
+ | bt locate_OS_exit ! Don't set the cursor position if x>21 | ||
+ | cmp/ge r2, r5 | ||
+ | bf locate_OS_exit ! Don't set the cursor position if y<1 | ||
+ | mov #8, r2 | ||
+ | cmp/gt r2, r5 | ||
+ | bt locate_OS_exit ! Don't set the cursor position if y>8 | ||
+ | mov.l #Cursor_SetPosition, r2 | ||
+ | add #-1, r5 | ||
+ | jmp @r2 ! Cursor_SetPosition | ||
+ | add #-1, r4 | ||
+ | ! --------------------------------------------------------------------------- | ||
+ | |||
+ | locate_OS_exit: | ||
+ | rts | ||
+ | nop | ||
+ | ! End of function locate_OS | ||
+ | </nowiki> | ||
}} | }} |
Revision as of 21:37, 14 February 2015
Synopsis
Header: fxcg/display.h
Syscall index: 0x1863
Function signature: void locate_OS(int X, int y)
Sets the cursor position for Print_OS.
Parameters
- x Must be in range of [1,21]
- y Must be in range of [1,8]
Comments
This function does bounds checking and will do nothing if x or y are out of range.
locate_OS: mov #1, r2 cmp/ge r2, r4 ! Is r4 >= 1? If so set T=1 bf locate_OS_exit ! If R4 is less than one do not set the cursor position mov #21, r6 cmp/gt r6, r4 bt locate_OS_exit ! Don't set the cursor position if x>21 cmp/ge r2, r5 bf locate_OS_exit ! Don't set the cursor position if y<1 mov #8, r2 cmp/gt r2, r5 bt locate_OS_exit ! Don't set the cursor position if y>8 mov.l #Cursor_SetPosition, r2 add #-1, r5 jmp @r2 ! Cursor_SetPosition add #-1, r4 ! --------------------------------------------------------------------------- locate_OS_exit: rts nop ! End of function locate_OS