]> git.sur5r.net Git - cc65/blob - libsrc/atari/graphics.s
Use decsp instead of subysp
[cc65] / libsrc / atari / graphics.s
1 ;
2 ; Christian Groessler, December 2000
3 ;
4 ; this file provides an equivalent to the BASIC GRAPHICS function
5 ;
6 ; void __fastcall__ graphics(unsigned char mode);
7
8         .export _graphics
9         .constructor    initscrmem,28
10
11         .import __graphmode_used
12
13         .include        "atari.inc"
14
15         .code
16
17
18 .proc   _graphics
19
20         rts             ; not implemented yet!
21
22 .endproc
23
24
25 ; calc. upper memory limit to use
26
27 .proc   initscrmem
28
29         lda     __graphmode_used
30         beq     ignore          ; mode 0 doesn't need adjustment
31         cmp     #32
32         bcs     ignore          ; invalid value
33
34         asl     a
35         tay
36         lda     APPMHI
37         sec
38         sbc     grmemusage,y
39         sta     APPMHI
40         lda     APPMHI+1
41         sbc     grmemusage+1,y
42         sta     APPMHI+1
43 ignore: rts
44
45 .endproc
46
47         .rodata
48
49 ; memory usage of the different graphics modes (0-31)
50 ; values < 0 of "bytes needed" are mappped to 0
51 ;               bytes needed    ; mode  ; val. of MEMTOP
52 grmemusage:
53         .word   0               ; 0     ; 39967
54         .word   0 ;-318         ; 1     ; 40285
55         .word   0 ;-568         ; 2     ; 40535
56         .word   0 ;-558         ; 3     ; 40525
57         .word   0 ;-298         ; 4     ; 40265
58         .word   182             ; 5     ; 39785
59         .word   1182            ; 6     ; 38785
60         .word   3198            ; 7     ; 36769
61         .word   7120            ; 8     ; 32847
62         .word   7146            ; 9     ; 32821
63         .word   7146            ; 10    ; 32821
64         .word   7146            ; 11    ; 32821
65         .word   162             ; 12    ; 39805
66         .word   0 ;-328         ; 13    ; 40295
67         .word   3278            ; 14    ; 36689
68         .word   7120            ; 15    ; 32847
69         .word   0               ; 16    ; 39967
70         .word   0 ;-320         ; 17    ; 40287
71         .word   0 ;-572         ; 18    ; 40539
72         .word   0 ;-560         ; 19    ; 40527
73         .word   0 ;-296         ; 20    ; 40263
74         .word   184             ; 21    ; 39783
75         .word   1192            ; 22    ; 38775
76         .word   3208            ; 23    ; 36759
77         .word   7146            ; 24    ; 32821
78         .word   7146            ; 25    ; 32821
79         .word   7146            ; 26    ; 32821
80         .word   7146            ; 27    ; 32821
81         .word   160             ; 28    ; 39807
82         .word   0 ;-332         ; 29    ; 40299
83         .word   3304            ; 30    ; 36663
84         .word   7146            ; 31    ; 32821
85
86 ; the program used to get these values (Atari BASIC):
87 ;  100 FILE=0
88 ;  110 IF FILE=1 THEN OPEN #1,8,0,"D:FREEMEM.OUT"
89 ;  120 IF FILE<>1 THEN OPEN #1,8,0,"E:"
90 ;  200 DIM G(32)
91 ;  210 FOR I=0 TO 32:GRAPHICS I:GOSUB 1000:G(I)=VAL:NEXT I
92 ;  220 GRAPHICS 0
93 ;  230 FOR I=0 TO 31:PRINT #1;I;":",G(I);" - ";G(0)-G(I):NEXT I
94 ;  240 CLOSE #1
95 ;  999 END
96 ;  1000 VAL=PEEK(741)+256*PEEK(742)
97 ;  1010 RETURN
98