|
| 1 | +; (c) 2016 Thomas BERNARd |
| 2 | +; https://github.com/miniupnp/AtariST |
| 3 | +; |
| 4 | +; X = zoom * (x*cos(a) - y*sin(a)) |
| 5 | +; Y = zoom * (x*sin(a) + y*cos(a)) |
| 6 | + |
| 7 | + code |
| 8 | + |
| 9 | + dc.w $a000 ; Line-A init |
| 10 | + dc.w $a00a ; Line-A hide mouse |
| 11 | + |
| 12 | + clr.l -(sp) ; Switch cursor off (hide it) +4 |
| 13 | + move.w #21,-(sp) ; Cursconf +6 |
| 14 | + trap #14 ; XBIOS |
| 15 | + |
| 16 | + move.w #4,(sp) ; Getrez |
| 17 | + trap #14 ; XBIOS |
| 18 | + move.w d0,rezbackup |
| 19 | + |
| 20 | + move.w #2,(sp) ; Physbase |
| 21 | + trap #14 ; XBIOS |
| 22 | + move.l d0,physbase |
| 23 | + |
| 24 | + move.w #3,(sp) ; Logbase |
| 25 | + trap #14 ; XBIOS |
| 26 | + move.l d0,logbase |
| 27 | + |
| 28 | + clr.w (sp) ; resolution (0=ST low, 1=ST Mid) |
| 29 | + move.l physbase,-(sp) ; +10 |
| 30 | + move.l logbase,-(sp) ; +14 |
| 31 | + move.w #5,-(sp) ; SetScreen ;+16 |
| 32 | + trap #14 ; XBIOS |
| 33 | + |
| 34 | + lea 16(sp),sp ; correct stack |
| 35 | + |
| 36 | + |
| 37 | + ; convert TGA palette to STf |
| 38 | + lea tga+18(pc),a0 |
| 39 | + lea palette(pc),a1 |
| 40 | + move.l a1,-(sp) ; PUSH palette |
| 41 | + moveq.l #0,d1 |
| 42 | + move.b tga+5(pc),d2 |
| 43 | + subq.w #1,d2 |
| 44 | +.pal |
| 45 | + move.b (a0)+,d0 ; Blue |
| 46 | + andi.w #$00e0,d0 |
| 47 | + lsr.w #5,d0 |
| 48 | + move.b (a0)+,d1 ; Green |
| 49 | + andi.w #$00e0,d1 |
| 50 | + lsr.w #1,d1 |
| 51 | + or.w d1,d0 |
| 52 | + move.b (a0)+,d1 ; Red |
| 53 | + andi.w #$00e0,d1 |
| 54 | + lsl.w #3,d1 |
| 55 | + or.w d1,d0 |
| 56 | + move.w d0,(a1)+ |
| 57 | + dbra d2,.pal |
| 58 | + |
| 59 | + move.l a0,imagep ; backup image data pointer |
| 60 | + |
| 61 | + move.w #6,-(sp) ; Setpalette |
| 62 | + trap #14 ; XBIOS |
| 63 | + addq.l #6,sp |
| 64 | + |
| 65 | + move.w #7,-(sp) ; Crawcin |
| 66 | + trap #1 ; GEMDOS |
| 67 | + addq.l #2,sp |
| 68 | + |
| 69 | + clr -(sp) |
| 70 | + trap #1 ; Pterm0 |
| 71 | + |
| 72 | + ; *** DATA *** |
| 73 | + data |
| 74 | + ; TGA (Truevision Targa) FORMAT : |
| 75 | + ; 0 BYTE ID length |
| 76 | + ; 1 BYTE color map type (0=None, 1=Yes, 2-255=Reserved) |
| 77 | + ; 2 BYTE Image type (0=None, 1=indexed raw, 2=True color raw, |
| 78 | + ; 3=grey raw, 9=indexed RLE, 10=True color RLE, |
| 79 | + ; 11=grey RLE) |
| 80 | + ; 3 WORD first color map index |
| 81 | + ; 5 WORD color map index length |
| 82 | + ; 7 BYTE color map bit per pixel (24) |
| 83 | + ; 8 WORD X-origin |
| 84 | + ; 10 WORD Y-origin |
| 85 | + ; 12 WORD Width |
| 86 | + ; 14 WORD Height |
| 87 | + ; 16 BYTE Pixel depth |
| 88 | + ; 17 BYTE image descriptor : lower 4bits = alpha depth, bits 4,5 = direction |
| 89 | + ; 18 n BYTES image ID field (n at offset 0) |
| 90 | + ; 18+n m BYTES color map data (m=color map length * color map bpp/8) |
| 91 | + ; 18+n+m x BYTES Image data |
| 92 | + |
| 93 | +tga |
| 94 | + incbin "logo64.tga" |
| 95 | + |
| 96 | + ; *** BSS *** |
| 97 | + bss |
| 98 | +rezbackup |
| 99 | + ds.w 1 |
| 100 | +physbase |
| 101 | + ds.l 1 |
| 102 | +logbase |
| 103 | + ds.l 1 |
| 104 | +imagep |
| 105 | + ds.l 1 |
| 106 | +palette |
| 107 | + ds.w 16 |
0 commit comments