~ubuntu-branches/ubuntu/trusty/libticalcs/trusty-proposed

« back to all changes in this revision

Viewing changes to src/romdump_8x/display.asm

  • Committer: Package Import Robot
  • Author(s): Andreas B. Mundt
  • Date: 2013-08-27 19:58:21 UTC
  • mfrom: (2.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20130827195821-biurlicyqb65gj3g
Tags: 1.1.8+dfsg2-2
* Provide original upstream source, but patch away pre-compiled
  binaries to be policy-compliant.
* Remove unnecessary dependency on 'autopoint', use autoreconf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;; -*- TI-Asm -*-
 
2
 
 
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
4
;;;
 
5
;;; TI-73/82/83/83+/84+/85/86 ROM Dumper
 
6
;;;
 
7
;;; Copyright (c) 2012 Benjamin Moody
 
8
;;;
 
9
;;; This program is free software; you can redistribute it and/or modify
 
10
;;; it under the terms of the GNU General Public License as published by
 
11
;;; the Free Software Foundation; either version 2 of the License, or
 
12
;;; (at your option) any later version.
 
13
;;;
 
14
;;; This program is distributed in the hope that it will be useful,
 
15
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
;;; GNU General Public License for more details.
 
18
;;;
 
19
;;; You should have received a copy of the GNU General Public License
 
20
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
;;;
 
22
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
23
 
 
24
;; DispHL:
 
25
;;
 
26
;; Display a 16-bit unsigned integer in decimal, padded on the left
 
27
;; with spaces.
 
28
;;
 
29
;; Input:
 
30
;; - HL = number
 
31
;; - (curRow) = cursor row
 
32
;; - (curCol) = cursor column
 
33
;;
 
34
;; Output:
 
35
;; - (curRow), (curCol) = updated
 
36
;;
 
37
;; Destroys:
 
38
;; - AF, BC, DE, HL
 
39
 
 
40
DispHL:
 
41
        ld b, 5
 
42
        ex de, hl
 
43
DispHL_PadLoop:
 
44
        ld a, ' '
 
45
        call PutC
 
46
        djnz DispHL_PadLoop
 
47
        ld hl, curCol
 
48
        ld a, (hl)
 
49
        push af
 
50
DispHL_Loop:
 
51
         dec (hl)
 
52
         ex de, hl
 
53
         ld bc, 100Ah
 
54
         xor a
 
55
DispHL_DivLoop:
 
56
         add hl, hl
 
57
         adc a, a
 
58
         cp c
 
59
         jr c, DispHL_DivNC
 
60
         sub c
 
61
         inc l
 
62
DispHL_DivNC:
 
63
         djnz DispHL_DivLoop
 
64
         ex de, hl
 
65
         add a, '0'
 
66
         call PutC
 
67
         dec (hl)
 
68
         ld a, d
 
69
         or e
 
70
         jr nz, DispHL_Loop
 
71
         pop af
 
72
        ld (hl), a
 
73
        ret
 
74
 
 
75
;; PutS:
 
76
;;
 
77
;; Display a zero-terminated ASCII string.
 
78
;;
 
79
;; Input:
 
80
;; - HL = address of string
 
81
;; - (curRow) = cursor row
 
82
;; - (curCol) = cursor column
 
83
;;
 
84
;; Output:
 
85
;; - (curRow), (curCol) = updated
 
86
;;
 
87
;; Destroys:
 
88
;; - AF, HL
 
89
 
 
90
PutS:
 
91
        ld a, (hl)
 
92
        inc hl
 
93
        or a
 
94
        ret z
 
95
        call PutC
 
96
        jr PutS