home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
64'er
/
64ER_CD.iso
/
s85xx
/
s8504b.d64
/
interface.src
< prev
next >
Wrap
Text File
|
1995-03-30
|
5KB
|
272 lines
; INTERFACE - EASY PARAMETER SETTING FOR SHAPE
; DRAWING ROUTINES FROM BASIC.
;
; RICHARD L. RYLANDER 11/23/84
;
;****************************************
ORIGIN=$CAC8
RAM =$0393
;
; PARAMETER LOCATIONS FOR VARIOUS SHAPES
;
XCENT =$036A
YCENT =$036F
XPLOT =$033F
YPLOT =$0341
XMIN =$034A
YMIN =$034C
XMID =$034D
YMID =$034F
XMAX =$0350
YMAX =$0352
RADIUS =$0377
HLEN =$0389
RI =$038F
RO =$038E
;
HVFLAG =$0383
VALUE =$0344
PLTFLG =$033E
;
DEFLAG =$FB
;
;****************************************
;
; FUNCTION LOCATIONS
;
GRFON =$C0E2 ; SWITCH TO GRAPHICS MODE
GRFOFF =$C103 ; RETURN TO TEXT DISPLAY
;
CLEARR=$C12C ; CLEAR BITMAP
CLRBYT=$C135 ; CLEAR (FILL) BYTE
COLORR=$C118 ; LOAD COLOR MAP
COLBYT=$C119 ; COLOR BYTE
;
PLOTR =$C14B ; POINT PLOT ROUTINE
LINER =$C2DB ; DRAW A LINE
FACETR =$C4E1 ; DRAW A SHADED FACET
;
;****************************************
;
; SHADED SHAPE DRAWING ROUTINES
;
SPHERR=$C7C7 ; SPHERE
CYLNDR=$C864 ; CYLINDER
TORUSR=$C90F ; TOP-VIEW TOROID
EDGTOR=$C88F ; EDGE-VIEW TOROID
SPOOLR=$CA3B ; INSIDE-VIEW TOROID
;
;****************************************
;
; BASIC ROM ROUTINES
;
CHKCOM=$AEFD ; CHECK FOR COMMA
EVAEXP=$AD9E ; EVALUATE EXPRESSION
FLTFIX=$B1AA ; CONVERT TO FIXED
;
*=RAM
LINFAC *=*+1 ; LINE OR FACET FLAG
;
*=ORIGIN
;
;****************************************
;
; GET PARAMETERS FROM BASIC CALLING STATEMENT
; OF THE FORM:
; SYS(FNCTN),PARAM1,PARAM2,PARAM3[OPT]
; WHERE THE THIRD PARAMETER (FOR EXAMPLE)
; MAY BE OPTIONAL (A DEFAULT VALUE IS USED
; IF THE PARAMETER IS NOT SPECIFIED)
;
GETNUM JSR CHKCOM ; LOOK FOR COMMA
JSR EVAEXP ; EVALUATE EXPRESSION
JSR FLTFIX ; CHANGE TO INTEGER WITH
; HIGH BYTE IN "A" AND LOW BYTE IN "Y"
RTS
;
; CHECK FOR ADDITIONAL (OPTIONAL) PARAMETERS
;
PCHECK LDA #$2C ; "," COMMA
LDY #0
STY DEFLAG
CMP ($7A),Y
BNE NOMORE ; NO COMMA - USE DEFAULT
JMP $0073
NOMORE LDY #$80
STY DEFLAG
RTS
;
; GET TWO ADDITIONAL PARAMETERS FOR TOROIDS
;
GETTWO JSR PCHECK
BIT DEFLAG
BMI DFAULT
JSR EVAEXP
JSR FLTFIX
STY RI
JSR GETNUM
STY RO
DFAULT RTS
;
;****************************************
;
; SET CENTER COORDINATES
;
CENTER JSR GETNUM
STY XCENT
STA XCENT+1
JSR GETNUM
STY YCENT
RTS
;
;****************************************
;
; CLEAR THE BITMAP, FILLING WITH (OPTIONAL)
; FILL VALUE SPECIFIED OR WITH (DEFAULT) "0"
;
CLEAR2 JSR PCHECK
BIT DEFLAG
BMI DEFCLR
JSR EVAEXP
JSR FLTFIX
.BYTE $2C
DEFCLR LDY #0
STY CLRBYT
JMP CLEARR
;
;****************************************
;
; FILL COLOR MAP WITH (OPTIONAL) COLOR BYTE
; SPECIFIED OR WITH (DEFAULT) "$01"
; (BLACK DOTS ON WHITE BACKGROUND)
;
COLOR2 JSR PCHECK
BIT DEFLAG
BMI DEFCOL
JSR EVAEXP
JSR FLTFIX
.BYTE $2C
DEFCOL LDY #$01
STY COLBYT
JMP COLORR
;
;****************************************
;
; PLOT OR UNPLOT POINTS
;
PLOT2 LDA #0
.BYTE $2C
UNPLT2 LDA #$80
STA PLTFLG
JSR GETNUM
STY XPLOT
STA XPLOT+1
JSR GETNUM
STY YPLOT
JMP PLOTR
;
;****************************************
;
; DRAW LINES BETWEEN (X1,Y1) AND (X2,Y2)
; OR SHADED FACETS BETWEEN THREE POINTS
; (X1,Y1), (X2,Y2) AND (X3,Y3)
;
LINE2 LDA #0
.BYTE $2C
FACET2 LDA #$80
STA LINFAC
JSR GETNUM
STY XMIN
STA XMIN+1
JSR GETNUM
STY YMIN
JSR GETNUM
STY XMID
STA XMID+1
JSR GETNUM
STY YMID
BIT LINFAC
BPL LDRAW
JSR GETNUM
STY XMAX
STA XMAX+1
JSR GETNUM
STY YMAX
JSR GETNUM
STY VALUE
JMP FACETR
LDRAW JMP LINER
;
;****************************************
;
; DRAW A SPHERE CENTERED AT (XCENT,YCENT)
; DEFAULT RADIUS IS LAST VALUE USED
;
SPHER2 JSR CENTER
JSR PCHECK
BIT DEFLAG
BMI SKIP1
JSR EVAEXP
JSR FLTFIX
STY RADIUS
SKIP1 JMP SPHERR
;
;****************************************
;
; DRAW A TOP-VIEW TOROID AT (XCENT,YCENT)
; DEFAULT INNER AND OUTER RADII ARE LAST USED
;
TORUS2 JSR CENTER
JSR GETTWO
JMP TORUSR
;
;****************************************
;
; DRAW CYLINDERS WITH AXES HORIZONTAL OR
; VERTICAL. DEFAULT RADIUS AND "HALF-LENGTH"
; ARE LAST VALUES USED.
;
VCYL2 LDA #$80
.BYTE $2C
HCYL2 LDA #0
STA HVFLAG
JSR CENTER
JSR PCHECK
BIT DEFLAG
BMI SKIP2
JSR EVAEXP
JSR FLTFIX
STY RADIUS
JSR GETNUM
STY HLEN
SKIP2 JMP CYLNDR
;
;****************************************
;
; DRAW EDGE-VIEW TOROIDS WITH AXES HORIZONTAL
; OR VERTICAL
; INNNER AND OUTER RADII ARE OPTIONAL
;
VTOR2 LDA #$80
.BYTE $2C
HTOR2 LDA #0
STA HVFLAG
JSR CENTER
JSR GETTWO
JMP EDGTOR
;
;****************************************
;
; DRAW INSIDE-VIEW TOROIDS, "SPOOLS",
; WITH AXES HORIZONTAL OR VERTICAL
; INNER AND OUTER RADII ARE OPTIONAL
;
VSPL2 LDA #$80
.BYTE $2C
HSPL2 LDA #0
STA HVFLAG
JSR CENTER
JSR GETTWO
JMP SPOOLR
.END