source: buchla-68k/vlib/vputc.s@ f7c91fc

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

Converted assembly language files.

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