Difference between revisions of "OSNEWL"

From BeebWiki
Jump to: navigation, search
(Implementations: C library oopsy)
 
m (1 revision)
(No difference)

Revision as of 23:58, 28 August 2013

Prints a newline sequence to the currently selected output stream(s).

Specification

 6502   Z80   6809   PDP11   80x86   32016   ARM  On entry: On exit:
A A A R0 AL R1 R0   = &0D

Prints an ASCII line feed (LF) followed by a carriage return (CR) via OSWRCH to the currently selected output stream(s).

Calling from BBC BASIC

  • PRINT ' calls OSNEWL

Entry points

  • BBC BASIC Entry Address: &FFE7
  • 6502 Entry Address: &FFE7
  • Z80 Entry Address: &FFE7
  • 6809 Entry Address: &FFE7
  • 80x86 Entry Address: INT &48, vectors via 0000:0120
  • 32000 Entry Address: SVC &04
  • PDP-11 Entry Address: EMT 5, vector &05
  • ARM Entry Address: SWI &03 "OS_NewLine"

Implementations

This routine has helped establish a standard newline sequence in the BBC series. Bear in mind that text files on 8-bit BBC Micros use only carriage returns (CR), whereas RISC OS text files use only line feeds (LF).

The order is significant because of page mode, and the ability to prevent scrolling with Ctrl-Shift. Outputting LF before CR ensures that while waiting for a scroll, the text cursor is still to the right of the last character printed.

The Arthur/RISC OS C Library for a long time translated C's \n to CR followed by LF, contrary to this convention. This was finally fixed in 32-bit versions.

Jgharston 17:01, 6 November 2009 (UTC)