source: buchla-68k/orig/IOLIB/VPUTC.S@ 0170798

Last change on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.0 KB
RevLine 
[3ae31e9]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 #$0000003F,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 #$FFFFFFFE,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 #$00FF,d0 * Mask off garbage bits
37 move.w (a0),d1 * Get word from video RAM
38 andi.w #$FF00,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 #$00FF,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.