Subversion Repositories Spectranet

[/] [branches/] [gnubinutils/] [rom/] [ui_output_stub.asm] - Diff between revs 371 and 384

Show entire file | Details | Blame | View Log

Rev 371 Rev 384
Line 20... Line 20...
;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
;THE SOFTWARE.
;THE SOFTWARE.
 
 
; These functions just wrap the character output routines, giving a
; These functions just wrap the character output routines, giving a
; ROM 0 entry point to get to them.
; ROM 0 entry point to get to them.
 
.include        "page1.xinc"
 
.include        "sysvars.inc"
 
.include        "sysdefs.inc"
 
.include        "spectranet.inc"
 
 
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
; F_putc_5by8
; F_putc_5by8
; Print characters 42 columns per line.
; Print characters 42 columns per line.
; The 'core' of the putchar routine, F_print calls this directly (handling
; The 'core' of the putchar routine, F_print calls this directly (handling
; the paging itself)
; the paging itself)
; The routine could probably do with improvement.
; The routine could probably do with improvement.
F_putc_5by8
.text
 
.globl F_putc_5by8
 
F_putc_5by8:
        call F_pr_getroutine
        call F_pr_getroutine
        call F_putc_5by8_impl
        call F_putc_5by8_impl
        jp F_pr_restore
        jp F_pr_restore
 
 
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
; F_print: Prints a null terminated string.
; F_print: Prints a null terminated string.
; Parameters: HL = pointer to string
; Parameters: HL = pointer to string
F_print
.globl F_print
.loop
F_print:
 
.loop2:
        ld a, (hl)
        ld a, (hl)
        and a                   ; NULL?
        and a                   ; NULL?
        jr z, .done
        jr z, .done2
        call F_putc_5by8        ; print the char
        call F_putc_5by8        ; print the char
        inc hl
        inc hl
        jr .loop
        jr .loop2
.done
.done2:
        ret
        ret
 
 
 
 
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
; F_clear: Clears the screen to spectranet UI colours.
; F_clear: Clears the screen to spectranet UI colours.
F_clear
.globl F_clear
 
F_clear:
        call F_pr_getroutine
        call F_pr_getroutine
        call F_clear_impl
        call F_clear_impl
        jp F_pr_restore
        jp F_pr_restore
 
 
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
; F_backspace:  Perform a backspace (move current character position 1
; F_backspace:  Perform a backspace (move current character position 1
; back and delete the right most character).
; back and delete the right most character).
F_backspace
.globl F_backspace
 
F_backspace:
        call F_pr_getroutine
        call F_pr_getroutine
        call F_backspace_impl
        call F_backspace_impl
        jp F_pr_restore
        jp F_pr_restore
 
 
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
; The following routines just fetch and restore the ROM page where the
; The following routines just fetch and restore the ROM page where the
; output routines are kept.
; output routines are kept.
F_pr_getroutine
.globl F_pr_getroutine
 
F_pr_getroutine:
        push af
        push af
        ld a, (v_pga)           ; save page A value
        ld a, (v_pga)           ; save page A value
        ld (v_pr_pga), a
        ld (v_pr_pga), a
        ld a, DATAROM
        ld a, DATAROM
        call F_setpageA         ; fetch the data rom
        call F_setpageA         ; fetch the data rom
        pop af
        pop af
        ret
        ret
 
 
F_pr_restore
.globl F_pr_restore
 
F_pr_restore:
        push af
        push af
        ld a, (v_pr_pga)
        ld a, (v_pr_pga)
        call F_setpageA
        call F_setpageA
        pop af
        pop af
        ret
        ret