Classic Computer Magazine Archive PROGRAM LISTING: 84-06/MACRO3.M65


0100 ;FILENAME: GRAPHICS.LIB
0110     .TITLE "GRAPHICS LIBRARY"
0120     .PAGE "GRAPHICS MACRO"
0130 ;
0140     .IF .NOT .DEF ROWCRS
0150       .ERROR "GREQU.M65 missing!"
0160       .ENDIF 
0170     .IF .NOT .DEF CPALOC
0180       .ERROR "SYSEQU.M65 missing!"
0190       .ENDIF 
0200 ;
0210 ;MACRO: GRAPHICS
0220 ;
0230 ;FORM: GRAPHICS N
0240 ;If N is <9, then N is a memory
0250 ;location, else N is a literal.
0260 ;
0270     .MACRO GRAPHICS 
0280 ;
0290     JMP @CONT
0300 @AX1
0310     .BYTE 0
0320 @AX2
0330     .BYTE 0
0340 @CONT
0350      XIO  12,6,0,0,"S:"
0360     .IF %1<9
0370       LDA #%1
0380       .ELSE 
0390       LDA %1
0400       .ENDIF 
0410     STA @AX2
0420     AND #$F0
0430     EOR #$10
0440     ORA #$0C
0450     STA @AX1
0460      OPEN  6,@AX1,@AX2,"S:"
0470     .ENDM 
0480     .PAGE "COLOR, POSITION & PLOT MACROS"
0490 ;
0500 ;MACRO: COLOR
0510 ;
0520 ;FORM: COLOR N
0530 ;If N<16, then N is literal.
0540 ;Else N is a memory location.
0550 ;
0560     .MACRO COLOR 
0570     .IF %1<16
0580       LDA #%1
0590       .ELSE 
0600       LDA %1
0610       .ENDIF 
0620     STA SPARE1
0630     .ENDM 
0640 ;
0650 ;MACRO: POSITION
0660 ;
0670 ;FORM: POSITION X,Y
0680 ;X and Y must be literals, not
0690 ;memory locations
0700 ;
0710     .MACRO POSITION 
0720     LDA # <%1
0730     STA COLCRS
0740     LDA # >%1
0750     STA COLCRS+1
0760     LDA #%2
0770     STA ROWCRS
0780     .ENDM 
0790 ;
0800 ;MACRO: PLOT
0810 ;
0820 ;FORM: PLOT X,Y
0830 ;X and Y must be literals, not
0840 ;memory locations
0850 ;
0860     .MACRO PLOT 
0870      POSITION  %1,%2
0880      @CH  6
0890     LDA #CPBINR
0900     STA ICCOM,X
0910     LDA #0
0920     STA ICBLEN,X
0930     STA ICBLEN+1,X
0940     LDA SPARE1
0950     JSR CIO
0960     .ENDM 
0970     .PAGE "DRAWTO & SETCOLOR MACROS"
0980 ;
0990 ;MACRO: DRAWTO
1000 ;
1010 ;FORM: DRAWTO X,Y
1020 ;X and Y must be literals as in
1030 ;POSITION
1040 ;
1050     .MACRO DRAWTO 
1060      POSITION  %1,%2
1070     LDA SPARE1
1080     STA ATACHR
1090      @CH  6
1100     LDA #CDRAW
1110     STA ICCOM,X
1120     LDA #CCLOSE
1130     STA ICAUX1,X
1140     LDA #0
1150     STA ICAUX2,X
1160     JSR CIO
1170     .ENDM 
1180 ;
1190 ;MACRO: SETCOLOR
1200 ;
1210 ;FORM: SETCOLOR REG,HUE,LUM
1220 ;Any parameter <16 is considered
1230 ;a memory location
1240 ;
1250     .MACRO SETCOLOR 
1260     .IF %1<16
1270       LDX #%1
1280       .ELSE 
1290       LDX %1
1300       .ENDIF 
1310     .IF %2>16
1320       LDA %2
1330       ASL A
1340       ASL A
1350       ASL A
1360       ASL A
1370       .ELSE 
1380       LDA #%2*16
1390       .ENDIF 
1400     .IF %3<16
1410       LDY #%3
1420       .ELSE 
1430       LDY %3
1440       .ENDIF 
1450     STA COLOR0,X
1460     TYA 
1470     AND #$0E
1480     CLC 
1490     ADC COLOR0,X
1500     STA COLOR0,X
1510     .ENDM 
1520 ;
1530 ;******* END OF GRAPHICS.LIB ***

Back to previous page