Difference between revisions of "Locate OS"

From WikiPrizm
Jump to navigationJump to search
Line 2: Line 2:
 
| name = locate_OS
 
| name = locate_OS
 
| index = 0x1863
 
| index = 0x1863
| signature = void locate_OS(int X, int y)
+
| signature = int locate_OS(int x, int y)
 
| 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]
 
| parameters = * '''x''' Must be in range of [1,21]
 
* '''y''' Must be in range of [1,8]
 
* '''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.
+
| returns = 0 on failure, 1 on success.
 +
| comments = This function does bounds checking and will do nothing if x or y are out of range. [[Cursor_SetPosition]] also does bounds checking and thus it should be used as opposed to this function.
 
  <nowiki>
 
  <nowiki>
 
locate_OS:
 
locate_OS:

Revision as of 20:51, 14 February 2015


Synopsis

Header: fxcg/display.h
Syscall index: 0x1863
Function signature: int 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]

Returns

0 on failure, 1 on success.

Comments

This function does bounds checking and will do nothing if x or y are out of range. Cursor_SetPosition also does bounds checking and thus it should be used as opposed to this function.

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