Changeset 4f508e6 in buchla-68k for vlib/glcplot.s


Ignore:
Timestamp:
07/01/2017 02:34:46 PM (7 years ago)
Author:
Thomas Lopatic <thomas@…>
Branches:
master
Children:
08e1da1
Parents:
f40a309
Message:

Converted assembly language files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vlib/glcplot.s

    rf40a309 r4f508e6  
    1 * ------------------------------------------------------------------------------
    2 * glcplot.s -- plot a pixel on the LCD display
    3 * Version 2 -- 1987-04-23 -- D.N. Lynx Crowe
    4 * (c) Copyright 1987 -- D.N. Lynx Crowe
    5 *
    6 *       GLCplot(x, y, val)
    7 *       unsigned x, y, val);
    8 *
    9 *               Plot a pixel at ('x', 'y') using lcdbase as the plane address
    10 *               in GLC RAM.  If 'val' is zero, the pixel is cleared,
    11 *               otherwise the pixel is cleared.  No error checking is done.
    12 *               Limits:  0 LE x LE 511,  0 LE y LE 63.
    13 * ------------------------------------------------------------------------------
     1| ------------------------------------------------------------------------------
     2| glcplot.s -- plot a pixel on the LCD display
     3| Version 2 -- 1987-04-23 -- D.N. Lynx Crowe
     4| (c) Copyright 1987 -- D.N. Lynx Crowe
     5
     6|       GLCplot(x, y, val)
     7|       unsigned x, y, val);
     8
     9|               Plot a pixel at ('x', 'y') using lcdbase as the plane address
     10|               in GLC RAM.  If 'val' is zero, the pixel is cleared,
     11|               otherwise the pixel is cleared.  No error checking is done.
     12|               Limits:  0 LE x LE 511,  0 LE y LE 63.
     13| ------------------------------------------------------------------------------
    1414                .text
    15 *
     15
    1616                .xdef   _GLCplot
    1717                .xref   _lcd_a0,_lcd_a1,_lcdbase
    18 *
    19 XLOC            .equ    8                       * 'x' parameter offset
    20 YLOC            .equ    10                      * 'y' parameter offset
    21 VAL             .equ    12                      * 'val' parameter offset
    22 *
    23 G_CRSWR         .equ    $46                     * GLC set cursor command
    24 G_MWRITE        .equ    $42                     * GLC write command
    25 G_MREAD         .equ    $43                     * GLC read command
    26 *
     18
     19XLOC            =       8                       | 'x' parameter offset
     20YLOC            =       10                      | 'y' parameter offset
     21VAL             =       12                      | 'val' parameter offset
     22
     23G_CRSWR         =       0x46                    | GLC set cursor command
     24G_MWRITE        =       0x42                    | GLC write command
     25G_MREAD         =       0x43                    | GLC read command
     26
    2727                .page
    28 *
    29 _GLCplot:       link    a6,#0                   * Link stack frames
    30                 moveq   #63,d0                  * d0 = (63-y) * 85
    31                 sub.w   YLOC(a6),d0             * ...
    32                 mulu    #85,d0                  * ...
    33                 clr.l   d1                      * d1 = x/6
    34                 move.w  XLOC(a6),d1             * ...
    35                 divu    #6,d1                   * ...
    36                 add.w   d1,d0                   * d0 = (63-y)*85 + (x/6)
    37                 swap    d1                      * d2 = 7 - (x%6) % 8
    38                 moveq   #7,d2                   * ...
    39                 sub.w   d1,d2                   * ...
    40                 andi.w  #7,d2                   * ...
    41                 lsr.w   #3,d1                   * d1 = (x%6) / 8
    42                 add.w   d1,d0                   * d0 = cursor address
    43                 add.w   _lcdbase,d0             * ...
    44                 move.w  d0,d1                   * d1 = cursor address, too
    45                 move.b  #G_CRSWR,_lcd_a1        * Send cursor address to GLC
    46                 move.b  d0,_lcd_a0              * ...
    47                 lsr.w   #8,d0                   * ...
    48                 move.b  d0,_lcd_a0              * ...
    49                 move.b  #G_MREAD,_lcd_a1        * Read old pixel byte
    50                 move.b  _lcd_a1,d0              * ... into d0
    51                 tst.w   VAL(a6)                 * Check val for zero
    52                 beq     glcplt1                 * Jump if val EQ 0
    53 *
    54                 bset    d2,d0                   * Set the pixel to 1
    55                 bra     glcplt2                 * Go write pixel to GLC
    56 *
    57 glcplt1:        bclr    d2,d0                   * Clear the pixel to 0
    58 *
    59 glcplt2:        move.b  #G_CRSWR,_lcd_a1        * Send cursor address to GLC
    60                 move.b  d1,_lcd_a0              * ...
    61                 lsr.w   #8,d1                   * ...
    62                 move.b  d1,_lcd_a0              * ...
    63                 move.b  #G_MWRITE,_lcd_a1       * Setup GLC to write pixel
    64                 move.b  d0,_lcd_a0              * Write pixel
    65                 unlk    a6                      * Unlink stack frames
    66                 rts                             * Return to caller
    67 *
     28
     29_GLCplot:       link    a6,#0                   | Link stack frames
     30                moveq   #63,d0                  | d0 = (63-y) | 85
     31                sub.w   YLOC(a6),d0             | ...
     32                mulu    #85,d0                  | ...
     33                clr.l   d1                      | d1 = x/6
     34                move.w  XLOC(a6),d1             | ...
     35                divu    #6,d1                   | ...
     36                add.w   d1,d0                   | d0 = (63-y)|85 + (x/6)
     37                swap    d1                      | d2 = 7 - (x%6) % 8
     38                moveq   #7,d2                   | ...
     39                sub.w   d1,d2                   | ...
     40                andi.w  #7,d2                   | ...
     41                lsr.w   #3,d1                   | d1 = (x%6) / 8
     42                add.w   d1,d0                   | d0 = cursor address
     43                add.w   _lcdbase,d0             | ...
     44                move.w  d0,d1                   | d1 = cursor address, too
     45                move.b  #G_CRSWR,_lcd_a1        | Send cursor address to GLC
     46                move.b  d0,_lcd_a0              | ...
     47                lsr.w   #8,d0                   | ...
     48                move.b  d0,_lcd_a0              | ...
     49                move.b  #G_MREAD,_lcd_a1        | Read old pixel byte
     50                move.b  _lcd_a1,d0              | ... into d0
     51                tst.w   VAL(a6)                 | Check val for zero
     52                beq     glcplt1                 | Jump if val EQ 0
     53
     54                bset    d2,d0                   | Set the pixel to 1
     55                bra     glcplt2                 | Go write pixel to GLC
     56
     57glcplt1:        bclr    d2,d0                   | Clear the pixel to 0
     58
     59glcplt2:        move.b  #G_CRSWR,_lcd_a1        | Send cursor address to GLC
     60                move.b  d1,_lcd_a0              | ...
     61                lsr.w   #8,d1                   | ...
     62                move.b  d1,_lcd_a0              | ...
     63                move.b  #G_MWRITE,_lcd_a1       | Setup GLC to write pixel
     64                move.b  d0,_lcd_a0              | Write pixel
     65                unlk    a6                      | Unlink stack frames
     66                rts                             | Return to caller
     67
    6868                .end
Note: See TracChangeset for help on using the changeset viewer.