source: buchla-68k/vlib/vputcv.s@ 9bf0f86

Last change on this file since 9bf0f86 was 4f508e6, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Converted assembly language files.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1| ------------------------------------------------------------------------------
2| vputcv.s -- store a character and attributes in video RAM
3| Version 1 -- 1988-10-05 -- D.N. Lynx Crowe
4| (c) Copyright 1988 -- D.N. Lynx Crowe
5| ------------------------------------------------------------------------------
6
7| vputcv(adr, row, col, chr, atr, cols)
8| unsigned int |adr, row, col, chr, atr, cols;
9
10| Stores character 'chr' at ('row', 'col') in the
11| full attribute text object at 'adr' with
12| attribute value 'atr' using a line length of 'len'.
13| ------------------------------------------------------------------------------
14
15 .text
16
17 .xdef _vputcv
18
19P_ADR = 8
20P_ROW = 12
21P_COL = 14
22P_CHR = 16
23P_ATR = 18
24P_LEN = 20
25
26 .page
27
28_vputcv: link a6,#0 | Link stack frame pointer
29 move.w P_ROW(a6),d0 | Get row
30 mulu P_LEN(a6),d0 | Multiply by len
31 clr.l d1 | Clear out d1
32 move.w P_COL(a6),d1 | Get col
33 add.l d1,d0 | Add col into d0 to get char. #
34 move.l d0,d1 | Develop cw = (cn/2)|6 in d1
35 andi.l #0xFFFFFFFE,d1 | ...
36 move.l d1,d2 | ...
37 add.l d1,d1 | ...
38 add.l d2,d1 | ...
39 add.l P_ADR(a6),d1 | Add sbase to cw
40 movea.l d1,a0 | a0 points at the word with the char.
41 btst.l #0,d0 | Odd char. location ?
42 bne vputcv1 | Jump if so
43
44 move.w P_CHR(a6),d0 | Get chr
45 andi.w #0x00FF,d0 | Mask off garbage bits
46 move.w (a0),d1 | Get word from video RAM
47 andi.w #0xFF00,d1 | Mask off old even character
48 or.w d0,d1 | OR in the new character
49 move.w d1,(a0)+ | Store the updated word in video RAM
50 bra vputcvx | Done -- go return to caller
51
52vputcv1: move.w P_CHR(a6),d0 | Get chr
53 lsl.w #8,d0 | Shift to high (odd) byte
54 move.w (a0),d1 | Get word from video RAM
55 andi.w #0x00FF,d1 | Mask off old odd character
56 or.w d0,d1 | OR in the new character
57 move.w d1,(a0)+ | Store the updated word in video RAM
58 addq.l #2,a0 | Point at the attribute word
59
60vputcvx: move.w P_ATR(a6),(a0) | Store new attributes in video RAM
61 unlk a6 | Unlink the stack frame
62 rts | Return to caller
63
64 .end
Note: See TracBrowser for help on using the repository browser.