Subversion Repositories Spectranet

[/] [branches/] [gnubinutils/] [rom/] [ui_output_stub.asm] - Blame information for rev 384

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 210 winston
;The MIT License
2
;
3
;Copyright (c) 2009 Dylan Smith
4
;
5
;Permission is hereby granted, free of charge, to any person obtaining a copy
6
;of this software and associated documentation files (the "Software"), to deal
7
;in the Software without restriction, including without limitation the rights
8
;to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
;copies of the Software, and to permit persons to whom the Software is
10
;furnished to do so, subject to the following conditions:
11
;
12
;The above copyright notice and this permission notice shall be included in
13
;all copies or substantial portions of the Software.
14
;
15
;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
;IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
;FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
;AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
;LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
;OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
;THE SOFTWARE.
22
 
23
; These functions just wrap the character output routines, giving a
24
; ROM 0 entry point to get to them.
25 384 winston
.include        "page1.xinc"
26
.include        "sysvars.inc"
27
.include        "sysdefs.inc"
28
.include        "spectranet.inc"
29 210 winston
 
30
;--------------------------------------------------------------------------
31
; F_putc_5by8
32
; Print characters 42 columns per line.
33
; The 'core' of the putchar routine, F_print calls this directly (handling
34
; the paging itself)
35
; The routine could probably do with improvement.
36 384 winston
.text
37
.globl F_putc_5by8
38
F_putc_5by8:
39 210 winston
        call F_pr_getroutine
40
        call F_putc_5by8_impl
41
        jp F_pr_restore
42
 
43
;--------------------------------------------------------------------------
44
; F_print: Prints a null terminated string.
45
; Parameters: HL = pointer to string
46 384 winston
.globl F_print
47
F_print:
48
.loop2:
49 224 winston
        ld a, (hl)
50
        and a                   ; NULL?
51 384 winston
        jr z, .done2
52 224 winston
        call F_putc_5by8        ; print the char
53
        inc hl
54 384 winston
        jr .loop2
55
.done2:
56 224 winston
        ret
57
 
58 210 winston
 
59
;--------------------------------------------------------------------------
60
; F_clear: Clears the screen to spectranet UI colours.
61 384 winston
.globl F_clear
62
F_clear:
63 210 winston
        call F_pr_getroutine
64
        call F_clear_impl
65
        jp F_pr_restore
66
 
67
;--------------------------------------------------------------------------
68
; F_backspace:  Perform a backspace (move current character position 1
69
; back and delete the right most character).
70 384 winston
.globl F_backspace
71
F_backspace:
72 210 winston
        call F_pr_getroutine
73
        call F_backspace_impl
74
        jp F_pr_restore
75
 
76
;--------------------------------------------------------------------------
77
; The following routines just fetch and restore the ROM page where the
78
; output routines are kept.
79 384 winston
.globl F_pr_getroutine
80
F_pr_getroutine:
81 210 winston
        push af
82
        ld a, (v_pga)           ; save page A value
83
        ld (v_pr_pga), a
84
        ld a, DATAROM
85
        call F_setpageA         ; fetch the data rom
86
        pop af
87
        ret
88
 
89 384 winston
.globl F_pr_restore
90
F_pr_restore:
91 210 winston
        push af
92
        ld a, (v_pr_pga)
93
        call F_setpageA
94
        pop af
95
        ret