[4f508e6] | 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)
|
---|
[84c0125] | 8 | | unsigned int *sbase, row, col, c, attrib;
|
---|
[4f508e6] | 9 |
|
---|
| 10 | | Stores character c at (row,col) in sbase with
|
---|
| 11 | | attribute value attrib.
|
---|
| 12 | | ------------------------------------------------------------------------------
|
---|
| 13 |
|
---|
[f40a309] | 14 | .text
|
---|
[4f508e6] | 15 |
|
---|
[8325447] | 16 | .xdef vputc
|
---|
[4f508e6] | 17 |
|
---|
[8325447] | 18 | vputc: link a6,#0 | Link stack frame pointer
|
---|
[4f508e6] | 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. #
|
---|
[84c0125] | 25 | move.w d0,d1 | Develop cw = (cn/2)*6 in d1
|
---|
[4f508e6] | 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 |
|
---|
| 43 | vputcx: unlk a6 | Unlink the stack frame
|
---|
| 44 | rts | Return to caller
|
---|
| 45 |
|
---|
| 46 | vputc1: 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 |
|
---|
[f40a309] | 56 | .end
|
---|