 
   setLineWrap: (linewrap) ->
 
-  scrollUp: ->
-    # @lineData.splice l, 0, []
-    # @clearLineData l
-    @insertLine 1, 0
+  scrollUp: (n = 1) ->
+    i = 0
+    while i < n
+      @lineData.splice @bottomMargin, 1
+      @lineData.splice @topMargin, 0, []
+      i++
+
     @updateScreen()
 
-  scrollDown: ->
-    @lineData.splice 0, 1
+  scrollDown: (n = 1) ->
+    i = 0
+    while i < n
+      @lineData.splice @topMargin, 1
+      @lineData.splice @bottomMargin, 0, []
+      i++
+
     @updateScreen()
 
   insertLine: (n, l = @cursorY) ->

      when "P" # DCH - Delete Character, from current position to end of field
        @deleteCharacters @n or 1
      when "S"
        @scrollUp @n or 1
      when "T"
        @scrollDown @n or 1
      when "X"
        @eraseCharacters @n
      when "Z"

    else
      @priorRow()

  goToNextRow: ->
    if @cursorY is @bottomMargin
      @scrollDown()
    else
      @nextRow()

  goToNextRowFirstColumn: ->
    @carriageReturn()
