-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPUTIMG.ASM
More file actions
92 lines (77 loc) · 1.91 KB
/
Copy pathPUTIMG.ASM
File metadata and controls
92 lines (77 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
;;#include "ti-85.h"
scanline = 0; TEXT_MEM ;8
xbytes = 0
xcoord = 0
;;struct imagedata {
;; byte xsize
;; byte ysize
;; byte data[]
;;;;;;putimage( b=y,c=x, hl -> imagedata)
putimage:
ld a,c \ ld (xcoord),a ;;save xcoord
push hl
ld e,b ;;e=ycoord
ld d,0
sla e \ rl d
sla e \ rl d
sla e \ rl d
sla e \ rl d ;;video spot: de*=16
ld a,c ;;c=xcoord
srl a \ srl a \ srl a ;;a=xcoord / 8
ld h,0
ld l,a
add hl,de ;;hl->graphics port offset
ld de,VIDEO_MEM
add hl,de ;;hl->graphics
ex de,hl ;;de->graphics
pop hl ;;; hl->image , de->graphics area
ld a,(hl)
ld (xbytes),a
inc hl
ld b,(hl) ;b=ylines
inc hl ;;now hl->image
load_scanline:
push bc
push de ;de->graphics
;;;assume hl->image
ld de,scanline
ld b,0 \ ld a,(xbytes) \ ld c,a ;;bc = byte count
ldir ;;; copy row into scanline
ex de,hl \ ld (hl),0 \ ex de,hl ;;last byte in scanline is zero
pop de ;de->graphics
;;;;shifting:
push hl ;;hl->image
ld hl,scanline
ld a,(xcoord)
and 111b
jr z,noshiftneeded
ld b,a ;;loop upto 7 times
or a ;; clear carry bit
shift_loop:
rr (hl) ;hl->scanline
inc hl
djnz shift_loop
noshiftneeded:
;;;;;output:
ld hl,scanline
;;;assume de->video spot
ld a,(xbytes)
inc a
ld b,a ;;loop xbytes width
output_loop:
ld a,(de)
xor (hl)
ld (hl),a
inc hl
inc de
djnz output_loop
;;;increment
ld bc,16 ;screen width
ex de,hl \ add hl,bc \ ex de,hl ;;add graphics+=16
pop hl ;;hl->image,de->graphics
pop bc
djnz load_scanline
ret
;;;;;;;;;;;;;end putimage
.END
;;;;;;;;;;;