Draw - Optimizations

Motivation

In this section I would like to demonstrate possible steps to optimize vectorlist drawing.

The shown possible steps are not ment to be "complete", exclusively right or particulary engenious.

Each scenario of ones own coding base provides grounds for other or more specific optimization technics.

I will show different versions of printing a vectorlist, which in each version step will be slightly more optimized in specific ways.

The demonstration program(s) will draw a vectorlist which represents a "hut" like:

Note:
Below given cycle measurement may be different to your own measurements. To have exactly the same measurements you must use exactly the same Vide configuration - which even I can't remember right now - but the relation of the values should be correct!



Hut


(The hut is pretty small, but as you will see, drawing a "small" list is easier to optimize - also in many games drawing many small objects is the predominant scenario)

Version 1 - 3170 (2284) cycles - basis

Basis:

;*****************************************************
; DEFINE SECTION
;*****************************************************
; load vectrex bios routine definitions
          INCLUDE "VECTREX.I"          ; vectrex function includes

;*****************************************************
; Variable / RAM SECTION
;*****************************************************
; insert your variables (RAM usage) in the BSS section
; user RAM starts at $c880
          BSS     
          ORG     $c880                ; start of our ram space

;*****************************************************
; HEADER SECTION
;*****************************************************
; The cartridge ROM starts at address 0
          CODE     
          ORG     0
; the first few bytes are mandatory, otherwise the BIOS will not load
; the ROM file, and will start MineStorm instead
          DB     "g GCE 1998", $80     ; "g' is copyright sign
          DW     music1                ; music from the rom
          DB     $F8, $50, $20, -$80   ; hight, width, rel y, rel x (from 0,0)
          DB     "DRAW LINES V1", $80  ; some game information, ending with $80
          DB     0                     ; end of game header

;*****************************************************
; CODE SECTION
;*****************************************************
; here the cartridge program starts off
main:
          JSR     Wait_Recal           ; Vectrex BIOS recalibration
          JSR     Intensity_5F         ; Sets the intensity of the
                                       ; vector beam to $5f
          LDA     #$b0                 ; scalefactor
          STA     VIA_t1_cnt_lo
          LDA     #$00                 ; position relative Y
          LDB     #$00                 ; position relative X
          JSR     Moveto_d             ; sets up VIA control register after a wait recal

          LDX     #vData               ; address of string
          JSR     Draw_VLc             ; Vectrex BIOS print routine
          BRA     main                 ; and repeat forever


;*****************************************************
; DATA SECTION
;*****************************************************

vData = VectorList
VectorList:
          DB +$07                      ; number of lines to draw
          DB +$00, +$06                ; draw to y, x
          DB +$07, +$00                ; draw to y, x
          DB +$05, -$03                ; draw to y, x
          DB -$05, -$03                ; draw to y, x
          DB -$07, +$00                ; draw to y, x
          DB +$07, +$06                ; draw to y, x
          DB +$00, -$06                ; draw to y, x
          DB -$07, +$06                ; draw to y, x

Version 2 - 1693 (807) cycles - scale factor!

In the above version (for demonstration purposes) I used a large scale factor and small vector strengths. Using a small scale factor and large vector strength results in huge optimization effects.

The scale factor and strength changes are not 1:1 - you have to experiment to get the same "sizes" of the resulting lists.

In the example I changed the scale factor from $b0 to $06, and multiplied each (original) strength by 18.

;*****************************************************
; DEFINE SECTION
;*****************************************************
; load vectrex bios routine definitions
          INCLUDE "VECTREX.I"          ; vectrex function includes

;*****************************************************
; Variable / RAM SECTION
;*****************************************************
; insert your variables (RAM usage) in the BSS section
; user RAM starts at $c880
          BSS     
          ORG     $c880                ; start of our ram space

;*****************************************************
; HEADER SECTION
;*****************************************************
; The cartridge ROM starts at address 0
          CODE     
          ORG     0
; the first few bytes are mandatory, otherwise the BIOS will not load
; the ROM file, and will start MineStorm instead
          DB     "g GCE 1998", $80     ; "g' is copyright sign
          DW     music1                ; music from the rom
          DB     $F8, $50, $20, -$80   ; hight, width, rel y, rel x (from 0,0)
          DB     "DRAW LINES V2", $80  ; some game information, ending with $80
          DB     0                     ; end of game header

;*****************************************************
; CODE SECTION
;*****************************************************
; here the cartridge program starts off
main:
          JSR     Wait_Recal           ; Vectrex BIOS recalibration
          JSR     Intensity_5F         ; Sets the intensity of the
                                       ; vector beam to $5f
          LDA     #$06                 ; scalefactor
          STA     VIA_t1_cnt_lo
          LDA     #$00                 ; position relative Y
          LDB     #$00                 ; position relative X
          JSR     Moveto_d             ; sets up VIA control register after a wait recal

          LDX     #vData               ; address of string
          JSR     Draw_VLc             ; Vectrex BIOS print routine
          BRA     main                 ; and repeat forever


;*****************************************************
; DATA SECTION
;*****************************************************

BLOW_UP = 18
vData = VectorList
VectorList:
          DB +$07                      ; number of lines to draw
          DB +$00*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$00*BLOW_UP, -$06*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$06*BLOW_UP; draw to y, x

Version 3 - 1686 (800) cycles - macro!

This version is a step "in between". Nothing really changed, only the call of "JSR     Draw VLc" was replaced with a macro call of exactly the same routine.

;*****************************************************
; DEFINE SECTION
;*****************************************************
; load vectrex bios routine definitions
          INCLUDE "VECTREX.I"          ; vectrex function includes

DRAW_VLC macro
          direct  $d0                  ; following code uses d0
          LDA     ,X+
Draw_VL_a_macro\?
          STA     $C823
          LDD     ,X
          STA     <VIA_port_a          ;Send Y to A/D
          CLR     <VIA_port_b          ;Enable mux
          LEAX    2,X                  ;Point to next coordinate pair
          NOP                          ;Wait a moment
          INC     <VIA_port_b          ;Disable mux
          STB     <VIA_port_a          ;Send X to A/D
          LDD     #$FF00               ;Shift reg=$FF (solid line), T1H=0
LF3ED\?:
          STA     <VIA_shift_reg       ;Put pattern in shift register
          STB     <VIA_t1_cnt_hi       ;Set T1H (scale factor?)
          LDD     #$0040               ;B-reg = T1 interrupt bit
LF3F4\?:
          BITB    <VIA_int_flags       ;Wait for T1 to time out
          BEQ     LF3F4\?
          NOP                          ;Wait a moment more
          STA     <VIA_shift_reg       ;Clear shift register (blank output)
          LDA     $C823                ;Decrement line count
          DECA    
          BPL     Draw_VL_a_macro\?    ;Go back for more points
          JSR     Check0Ref            ;Reset zero reference if necessary
          endm

;*****************************************************
; Variable / RAM SECTION
;*****************************************************
; insert your variables (RAM usage) in the BSS section
; user RAM starts at $c880
          BSS     
          ORG     $c880                ; start of our ram space

;*****************************************************
; HEADER SECTION
;*****************************************************
; The cartridge ROM starts at address 0
          CODE     
          ORG     0
; the first few bytes are mandatory, otherwise the BIOS will not load
; the ROM file, and will start MineStorm instead
          DB     "g GCE 1998", $80     ; "g' is copyright sign
          DW     music1                ; music from the rom
          DB     $F8, $50, $20, -$80   ; hight, width, rel y, rel x (from 0,0)
          DB     "DRAW LINES V3", $80  ; some game information, ending with $80
          DB     0                     ; end of game header

;*****************************************************
; CODE SECTION
;*****************************************************
; here the cartridge program starts off
main:
          JSR     Wait_Recal           ; Vectrex BIOS recalibration
          JSR     Intensity_5F         ; Sets the intensity of the
                                       ; vector beam to $5f
          LDA     #$06                 ; scalefactor
          STA     VIA_t1_cnt_lo
          LDA     #$00                 ; position relative Y
          LDB     #$00                 ; position relative X
          JSR     Moveto_d             ; sets up VIA control register after a wait recal

          LDX     #vData               ; address of string
          DRAW_VLC                     ; Macro print routine
          BRA     main                 ; and repeat forever


;*****************************************************
; DATA SECTION
;*****************************************************

BLOW_UP = 18
vData = VectorList
VectorList:
          DB +$07                      ; number of lines to draw
          DB +$00*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$00*BLOW_UP, -$06*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$06*BLOW_UP; draw to y, x

Version 4 - 1531 (645) cycles - optimized macro!

The above introduced macro was changed to a manualy optimized version.

;*****************************************************
; DEFINE SECTION
;*****************************************************
; load vectrex bios routine definitions
          INCLUDE "VECTREX.I"        ; vectrex function includes

DRAW_VLC          macro
          direct  $d0                 ; following code uses d0
          LDD     ,X++                ;
          STA     $C823               ;
          CLRA
_DRAW_VLA\?:
          STD     VIA_port_b
          LDB     ,X+
          INC     VIA_port_b          ;Disable mux
          STB     VIA_port_a          ;Send X to A/D
          DEC     VIA_shift_reg       ;Put pattern in shift register
          STA     VIA_t1_cnt_hi       ;enable timer 1

          LDB     ,X+                 ; 6
          DEC     $C823               ; 7
          BEQ     _DRAW_END\?         ; 3 Go back for more points
          LDA     #$40                ;B-reg = T1 interrupt bit
LF_1\?:
          BITA    VIA_int_flags       ;Wait for T1 to time out
          BEQ     LF_1\?              ;
          CLRA                        ;Wait a moment more
          STA     VIA_shift_reg       ;Clear shift register (blank output)
          BRA     _DRAW_VLA\?         ; 3
_DRAW_END\?:
          LDA     #$40                ;B-reg = T1 interrupt bit
LF_2\?:
          BITA    VIA_int_flags       ;Wait for T1 to time out
          BEQ     LF_2\?              ;
          CLRA                        ;Wait a moment more
          STA     VIA_shift_reg
; one more round
          STD     VIA_port_b
          LDB     ,X+
          INC     VIA_port_b          ;Disable mux
          STB     VIA_port_a          ;Send X to A/D
          DEC     VIA_shift_reg       ;Put pattern in shift register
          STA     VIA_t1_cnt_hi       ;enable timer 1

          LDA     #$40                ;B-reg = T1 interrupt bit
LF_3\?:
          BITA    VIA_int_flags       ;Wait for T1 to time out
          BEQ     LF_3\?
          CLR     VIA_shift_reg       ;Clear shift register (blank output)
          endm

;*****************************************************
; Variable / RAM SECTION
;*****************************************************
; insert your variables (RAM usage) in the BSS section
; user RAM starts at $c880
          BSS     
          ORG     $c880               ; start of our ram space

;*****************************************************
; HEADER SECTION
;*****************************************************
; The cartridge ROM starts at address 0
          CODE     
          ORG     0
; the first few bytes are mandatory, otherwise the BIOS will not load
; the ROM file, and will start MineStorm instead
          DB     "g GCE 1998", $80     ; "g' is copyright sign
          DW     music1                ; music from the rom
          DB     $F8, $50, $20, -$80   ; hight, width, rel y, rel x (from 0,0)
          DB     "DRAW LINES V4", $80  ; some game information, ending with $80
          DB     0                     ; end of game header

;*****************************************************
; CODE SECTION
;*****************************************************
; here the cartridge program starts off
main:
          JSR     Wait_Recal           ; Vectrex BIOS recalibration
          JSR     Intensity_5F         ; Sets the intensity of the
                                       ; vector beam to $5f
          LDA     #$06                 ; scalefactor
          STA     VIA_t1_cnt_lo
          LDA     #$00                 ; position relative Y
          LDB     #$00                 ; position relative X
          JSR     Moveto_d             ; sets up VIA control register after a wait recal

          LDX     #vData               ; address of string
          DRAW_VLC                     ; Macro print routine
          BRA     main                 ; and repeat forever


;*****************************************************
; DATA SECTION
;*****************************************************

BLOW_UP = 18
vData = VectorList
VectorList:
          DB +$07                      ; number of lines to draw
          DB +$00*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$00*BLOW_UP, -$06*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$06*BLOW_UP; draw to y, x

Version 5 - 1416 (529) cycles - loop unrolling and cycle specific!

The loop in the vector drawing was unrolled, and the actual drawing routine does not have a wait loop anymore, since we now that the length of the loop (= scalefactor) is 6. We can use the information, that we only draw for 6 cycles, to NOT wait for these 6 cycles to finish - we know how many cycles our instructions take.

To do the loop unrolling and some of the math involved (jump into a unrolled vector drawing routine) we changed the first parameter of the vectorlist to have a unrolled offset counter instead of the vectorlist length.

The maximum unrolled loop in this version is 11 vectors (maximum vectorlist size).

The size of the header (10) and one line (16) is manually computed, but could also be automatically gotten from address "math".

;*****************************************************
; DEFINE SECTION
;*****************************************************
; load vectrex bios routine definitions
          INCLUDE "VECTREX.I"         ; vectrex function includes

ONE_LINE_LENGTH   EQU 16
LENGTH_OF_HEADER  EQU (4+2+2+2)
MAX_LINE_NUM      EQU 23


ONE_LINE_DRAW macro                   ; cycles
          INC     VIA_port_b          ; [6] Disable mux
          STB     VIA_port_a          ; [6] Send X to A/D
          DEC     VIA_shift_reg       ; [6] Put pattern in shift register
          CLR     VIA_t1_cnt_hi       ; [4] enable timer 1
          LDD     ,X++                ; [8] load Y coordinate to A, X coordinate to B
          STA     VIA_port_a          ; [4] Send Y to A/D
          CLR     VIA_port_b          ; [4] enable mux, thus y integrators are set to Y
          CLR     VIA_shift_reg       ; [4] turn the lights off
          endm

MY_SPRITE_DRAW_VLC_UNLOOP_SMALL macro
          LDD      ,X++               ;(2)
          STA     VIA_port_a          ;(2) [4] Send Y to A/D
          CLR     VIA_port_b          ;(2) [4] enable mux, thus y integrators are set to Y
          JMP     [i_jump]            ;(4)
JUMP_INTO_ALL\?:
JUMP_INTO_11\?:
          ONE_LINE_DRAW
JUMP_INTO_10\?:
          ONE_LINE_DRAW
JUMP_INTO_09\?:
          ONE_LINE_DRAW
JUMP_INTO_08\?:
          ONE_LINE_DRAW
JUMP_INTO_07\?:
          ONE_LINE_DRAW
JUMP_INTO_06\?:
          ONE_LINE_DRAW
JUMP_INTO_05\?:
          ONE_LINE_DRAW
JUMP_INTO_04\?:
          ONE_LINE_DRAW
JUMP_INTO_03\?:
          ONE_LINE_DRAW
JUMP_INTO_02\?:
          ONE_LINE_DRAW
JUMP_INTO_01\?:
          INC     VIA_port_b            ; [6] Disable mux
          STB     VIA_port_a            ; [6] Send X to A/D
          DEC     VIA_shift_reg         ; [6] Put pattern in shift register
          CLR     VIA_t1_cnt_hi         ; [4] enable timer 1
          NOP     3
          endm

;*****************************************************
; Variable / RAM SECTION
;*****************************************************
; insert your variables (RAM usage) in the BSS section
; user RAM starts at $c880
          BSS     
          ORG     $c880                ; start of our ram space
i jump ds 2

;*****************************************************
; HEADER SECTION
;*****************************************************
; The cartridge ROM starts at address 0
          CODE     
          ORG     0
; the first few bytes are mandatory, otherwise the BIOS will not load
; the ROM file, and will start MineStorm instead
          DB     "g GCE 1998", $80     ; "g' is copyright sign
          DW     music1                ; music from the rom
          DB     $F8, $50, $20, -$80   ; hight, width, rel y, rel x (from 0,0)
          DB     "DRAW LINES V5", $80  ; some game information, ending with $80
          DB     0                     ; end of game header

;*****************************************************
; CODE SECTION
;*****************************************************
; here the cartridge program starts off
main:
          JSR     Wait_Recal           ; Vectrex BIOS recalibration
          JSR     Intensity_5F         ; Sets the intensity of the
                                       ; vector beam to $5f
          LDA     #$06                 ; scalefactor
          STA     VIA_t1_cnt_lo
          LDA     #$00                 ; position relative Y
          LDB     #$00                 ; position relative X
          JSR     Moveto_d             ; sets up VIA control register after a wait recal

          LDX     #vData               ; address of string
          LDD     ,X++                 ; load offset of vector list draw
          ADDD    #(unloop_start_address0+LENGTH_OF_HEADER-12*ONE_LINE_LENGTH); 4=JMP [], 2=LDD ,X++
          STD     i_jump
unloop_start_address0:
          MY_SPRITE_DRAW_VLC_UNLOOP_SMALL
          NOP     2
          CLR     VIA_shift_reg        ; [4] turn the lights off
          BRA     main                 ; and repeat forever


;*****************************************************
; DATA SECTION
;*****************************************************

BLOW_UP = 18
vData = VectorList
VectorList:
          DW (MAX_LINE_NUM-(7+1))*ONE_LINE_LENGTH
          DB +$00*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$05*BLOW_UP, -$03*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$00*BLOW_UP; draw to y, x
          DB +$07*BLOW_UP, +$06*BLOW_UP; draw to y, x
          DB +$00*BLOW_UP, -$06*BLOW_UP; draw to y, x
          DB -$07*BLOW_UP, +$06*BLOW_UP; draw to y, x

Version 6 - 1225 (335) cycles - optimized compiled lines!

DRAW_SCALE  =       6                    
MOVE_SCALE  =       DRAW_SCALE           
                                         
;*****************************************************    
;           DEFINE  SECTION              
;*****************************************************    
;           load    vectrex bios routine definitions  
            INCLUDE "VECTREX.I"         ; vectrex function includes 
                                         
MY_SIMPLE_MOVE_TO_D_START macro          
            STA     <VIA_port_a         ;Store Y in D/A register 
            LDA     #$CE                ;Blank low, zero high? 
            STA     <VIA_cntl           ; 
            CLRA                         
            STA     <VIA_port_b         ;Enable mux ; hey dis si "break integratorzero 440" 
            INC     <VIA_port_b         ;Disable mux 
            STB     <VIA_port_a         ;Store X in D/A register 
            STA     <VIA_t1_cnt_hi      ;enable timer 
            endm                         
                                         
MY_MOVE_TO_B_END macro                   
            local   LF33D                
            LDB     #$40                ; 
LF33D:      BITB    <VIA_int_flags      ; 
            BEQ     LF33D               ; 
            endm                         
                                         
;           ***************************************************************************************   
;           use     registers D, U, X (S) !  
;           ***************************************************************************************   
;           initialize draw and do first line  
INIT_DRAW_6_MOVE_END macro pos           
;           this    can be put into moveto  
;           ldb     #DRAW_SCALE          
;           stb     VIA_t1_cnt_lo                 also stores scale  to timer t1 (lo)  
                                         
            ldx     #256+lo(pos)        ; x_hi = 1 (mux disabled), x_lo = x 
            ldu     #hi(pos)            ; s_hi = 0 (mux enabled), s_lo = y 
;           MY_MOVE_TO_B_END end of movement, above values could be set befor, end destroys "b"  
            stu     <VIA_port_b         ; mux enabled, set dac to y value 
            ldd     #$ee                ; a = zero, b = blank disbaled, zero disabled 
            stx     <VIA_port_b         ; mux disabled, set dac to x value 
            STA     <VIA_t1_cnt_hi      ; enable timer 1 (write 0 to it) 
            stb     <VIA_cntl           ; ZERO disabled, and BLANK disabled (we are drawing!) 
            endm                         
;           ***************************************************************************************   
;           any     line after the first of our drawing  
LINE_DRAW_6_x macro pos                  
;           loading Setup registers      
;           directly is even faster than 4 puls from stack (12 vs 13 cycles)  
                                        ; pre load all values, since we must wait before we finish the current drawing 
            ldu     #hi(pos)            ; s_hi = 0 (mux enabled), s_lo = y 
            ldx     #$80ce              ; eighty is already set to aux, but we need a register, 
                                        ; and x is available, so we reset aux in order to set cntl 
            ldd     #$ee                ; light ON, ZERO OFF 
            stu     <VIA_port_b         ; mux enabled, set dac to y value (strangly and luckily, timing 
                                        ; allows this to be set BEFORE we switch the light off) 
                                         
            ldu     #256+lo(pos)        ; u_hi = 1 (mux disabled), u_lo = x 
                                         
            stx     VIA_aux_cntl        ; ZERO disabled, and BLANK enabled (we are NOT drawing!) 
            stu     <VIA_port_b         ; mux disabled, set dac to x value 
            STA     <VIA_t1_cnt_hi      ; enable timer 1 (write 0 to it) 
            stb     <VIA_cntl           ; ZERO disabled, and BLANK disabled (we are drawing!) 
            endm                         
;           ***************************************************************************************   
;           finish  last line and deinit our drawing  
DEINIT_DRAW_6 macro                      
            nop     4                   ; here we have to wait for 8 cycles, 
                                        ; otherwise the last vector is not finished correctly 
            ldd     #MOVE_SCALE*256+($cc) ; preload scale andcntl value 
            sta     <VIA_t1_cnt_lo      ; set the scale for the next move 
            STB     <VIA_cntl           ; BLANK enabled, zero enabled (= not drawing and going back to zero) 
            endm                         
;           ***************************************************************************************   
                                         
;*****************************************************    
;           Variable / RAM SECTION       
;*****************************************************    
;           insert  your variables (RAM usage) in the BSS section  
;           user    RAM starts at $c880  
            BSS                          
            ORG     $c880               ; start of our ram space 
i_jump      ds      2                    
;*****************************************************    
;           HEADER  SECTION              
;*****************************************************    
;           The     cartridge ROM starts at address 0  
            CODE                         
            ORG     0                    
;           the     first few bytes are mandatory, orwise  BIOS will not load  
;           the     ROM file, and will start MineStorm instead  
            DB      "g GCE 1998", $80   ; "g' is copyright sign 
            DW      music1              ; music from the rom 
            DB      $F8, $50, $20, -$80 ; hight, width, rel y, rel x (from 0,0) 
            DB      "DRAW LINES V6", $80 ; some game information, ending with $80 
            DB      0                   ; end of game header 
                                         
;*****************************************************    
;           CODE    SECTION              
;*****************************************************    
;           here    the cartridge program starts off  
main:                                    
            JSR     Wait_Recal          ; Vectrex BIOS recalibration 
            JSR     Intensity_5F        ; Sets the intensity of the 
                                        ; vector beam to $5f 
                                         
                                         
            LDA     #$06                ; scalefactor 
            STA     VIA_t1_cnt_lo        
            LDD     #0                        
            MY_SIMPLE_MOVE_TO_D_START    
                                         
                                         
                                         
BLOWUP_SMPLT =      18                   
            INIT_DRAW_6_MOVE_END ( ( 0 * BLOWUP_SMPLT )*256 + (6*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (7 * BLOWUP_SMPLT )*256 + (0*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (5 * BLOWUP_SMPLT )*256 + (-3*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (-5 * BLOWUP_SMPLT )*256 + (-3*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (-7 * BLOWUP_SMPLT )*256 + (0*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (7 * BLOWUP_SMPLT )*256 + (6*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (0 * BLOWUP_SMPLT )*256 + (-6*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (-7 * BLOWUP_SMPLT )*256 + (6*BLOWUP_SMPLT) )  
            DEINIT_DRAW_6                
                                         
                                         
            BRA     main                ; and repeat forever 
                                         
                                         
;*****************************************************    

Version 7 - 1103 (204) cycles - reality distortion (doesn't look like a house anymore)!

DRAW_SCALE  =       6                    
MOVE_SCALE  =       DRAW_SCALE           
;*****************************************************    
;           DEFINE  SECTION              
;*****************************************************    
;           load    vectrex bios routine definitions  
            INCLUDE "VECTREX.I"         ; vectrex function includes 
MY_SIMPLE_MOVE_TO_D_START macro          
            STA     <VIA_port_a         ;Store Y in D/A register 
            LDA     #$CE                ;Blank low, zero high? 
            STA     <VIA_cntl           ; 
            CLRA                         
            STA     <VIA_port_b         ;Enable mux ; hey dis si "break integratorzero 440" 
            INC     <VIA_port_b         ;Disable mux 
            STB     <VIA_port_a         ;Store X in D/A register 
            STA     <VIA_t1_cnt_hi      ;enable timer 
            endm                         
MY_MOVE_TO_B_END macro                   
            local   LF33D                
            LDB     #$40                ; 
LF33D:      BITB    <VIA_int_flags      ; 
            BEQ     LF33D               ; 
            endm                         
MY_SIMPLE_MOVE_TO_D_START macro          
            STA     <VIA_port_a         ;Store Y in D/A register 
            LDA     #$CE                ;Blank low, zero high? 
            STA     <VIA_cntl           ; 
            CLRA                         
            STA     <VIA_port_b         ;Enable mux ; hey dis si "break integratorzero 440" 
            INC     <VIA_port_b         ;Disable mux 
            STB     <VIA_port_a         ;Store X in D/A register 
            STA     <VIA_t1_cnt_hi      ;enable timer 
            endm                         
;           ***************************************************************************************   
;           use     registers D, U, X (S) !  
;           ***************************************************************************************   
;           initialize draw and do first line  
INIT_DRAW_6_MOVE_END macro pos           
;           this    can be put into moveto  
            ldx     #256*1+lo(pos)      ; x_hi = 0000 0001 (ramp enabled, mux disabled), x_lo = x 
            ldu     #256*128+hi(pos)    ; u_hi = 1000 0000 (ramp disabled, mux enabled), u_lo = y 
            MY_MOVE_TO_B_END            ; end of movement, above values could be set befor, end destroys "b" 
            stu     <VIA_port_b         ; mux enabled, set dac to y value 
            ldd     #$ee                ; a = zero, b = blank disbaled, zero disabled 
            stx     <VIA_port_b         ; mux disabled, set dac to x value 
            std     <VIA_aux_cntl       ; Shift reg mode = 000 free disable, T1 PB7 disabled 
            endm                         
;           ***************************************************************************************   
;           any     line after the first of our drawing  
LINE_DRAW_6_x macro pos                  
;           loading Setup registers      
;           directly is even faster than 4 puls from stack (12 vs 13 cycles)  
                                        ; pre load all values, since we must wait before we finish the current drawing 
            ldu     #256*128+hi(pos)    ; u_hi = 1000 0000 (ramp disabled, mux enabled), u_lo = y 
            ldx     #256*1+lo(pos)      ; u_hi = 0000 0001 (ramp enabled, mux disabled), u_lo = x 
            stu     <VIA_port_b         ; mux enabled, set dac to y value (strangly and luckily, timing 
            stx     <VIA_port_b         ; mux disabled, set dac to x value 
            endm                         
;           ***************************************************************************************   
;           finish  last line and deinit our drawing  
DEINIT_DRAW_6 macro                      
            nop     6                   ; here we have to wait for 8 cycles, 
                                        ; otherwise the last vector is not finished correctly 
            ldd     #128*256+($cc)      ; preload scale andcntl value 
            STD     <VIA_aux_cntl       ; Shift reg mode = 000 free disable, T1 PB7 enabled 
            nop     6                   ; may be add one NOP for zeroing! 
            endm                         
;           ***************************************************************************************   
;*****************************************************    
;           Variable / RAM SECTION       
;*****************************************************    
;           insert  your variables (RAM usage) in the BSS section  
;           user    RAM starts at $c880  
            BSS                          
            ORG     $c880               ; start of our ram space 
i_jump      ds      2                    
;*****************************************************    
;           HEADER  SECTION              
;*****************************************************    
;           The     cartridge ROM starts at address 0  
            CODE                         
            ORG     0                    
;           the     first few bytes are mandatory, orwise  BIOS will not load  
;           the     ROM file, and will start MineStorm instead  
            DB      "g GCE 1998", $80   ; "g' is copyright sign 
            DW      music1              ; music from the rom 
            DB      $F8, $50, $20, -$80 ; hight, width, rel y, rel x (from 0,0) 
            DB      "DRAW LINES V7", $80 ; some game information, ending with $80 
            DB      0                   ; end of game header 
;*****************************************************    
;           CODE    SECTION              
;*****************************************************    
;           here    the cartridge program starts off  
main:                                    
            JSR     Wait_Recal          ; Vectrex BIOS recalibration 
            JSR     Intensity_5F        ; Sets the intensity of the 
                                        ; vector beam to $5f 
            LDA     #$06                ; scalefactor 
            STA     VIA_t1_cnt_lo        
            LDD     #0                   
            MY_SIMPLE_MOVE_TO_D_START    
BLOWUP_SMPLT =      18                   
            INIT_DRAW_6_MOVE_END ( ( 0 * BLOWUP_SMPLT )*256 + (6*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (7 * BLOWUP_SMPLT )*256 + (0*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (5 * BLOWUP_SMPLT )*256 + (-3*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (-5 * BLOWUP_SMPLT )*256 + (-3*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (-7 * BLOWUP_SMPLT )*256 + (0*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (7 * BLOWUP_SMPLT )*256 + (6*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (0 * BLOWUP_SMPLT )*256 + (-6*BLOWUP_SMPLT) )  
            LINE_DRAW_6_x ( (-7 * BLOWUP_SMPLT )*256 + (6*BLOWUP_SMPLT) )  
            DEINIT_DRAW_6                
            BRA     main                ; and repeat forever 
                                         
;*****************************************************    

Version 8 - 1566 (327) Smartlist generated by Vide!

Just a comparisson value - how smartlists figure into this (scale 9 though).