The HIRES.I include file resides on the Kyan Pascal 2.x Advanced Graphics Toolkit Disk.
- PROCEDURE graphics(mode: Integer);
- PROCEDURE drawto(horiz,vert,color: Integer);
- PROCEDURE clearscreen;
- PROCEDURE plot(horiz,vert,color: Integer);
- PROCEDURE LINETO(X,Y,COLOR:INTEGER);
- PROCEDURE MOVE(X,Y:INTEGER);
Source Code
PROCEDURE graphics(mode: Integer);
BEGIN
#a
TXA
PHA
LDX #$60
LDA #$0C
STA $342,X
JSR $E456
LDA #>$4000
STA $2E5
LDA #<$4000
STA $2E6
LDA #>$2000
STA $E
LDA #<$2000
STA $F
LDX #$60
LDA #$03 ;OPEN
STA $342,X
LDA #>FILEN
STA $344,X
LDA #<FILEN
STA $345,X
LDY #5
LDA (_SP),Y
STA $34B,X
AND #$F0
EOR #$10
ORA #$0C
STA $34A,X
JSR $E456
BPL GR1
JMP $9406
FILEN DB $53 ;S
DB $3A ;:
DB $9B
GR1 PLA
TAX
#
END;
PROCEDURE drawto(horiz,vert,color: Integer);
BEGIN
#a
jsr plot
#
END;
#a
plot equ *
TXA
PHA
LDY #7
LDA (_SP),Y
STA $54
LDY #9
LDA (_SP),Y
STA $55
INY
LDA (_SP),Y
STA $56
LDY #5
LDA (_SP),Y
STA $2FB
LDX #$60
LDA #$11
STA $342,X
LDA #$0C
STA $34A,X
LDA #0
STA $34B,X
JSR $E456
PLA
TAX
rts
#
PROCEDURE clearscreen;
BEGIN
#a
stx _t
ldx #$60
lda #$0b
sta $342,x
lda #0
sta $348,x
sta $349,x
lda #125
jsr $e456
ldx _t
#
END;
PROCEDURE plot(horiz,vert,color: Integer);
BEGIN
#a
jsr plot
#
END;
#a
plot equ *
LDY #7
LDA (_SP),Y
STA $54
STA Y1
INY
LDA (_SP),Y
STA Y1+1
LDY #9
LDA (_SP),Y
STA $55
STA X1
INY
LDA (_SP),Y
STA $56
STA X1+1
;CLIP IT
LDA Y1
CMP #>192
LDA Y1+1
SBC #<192
BCC P.OV1
RTS ;LEAVE OUT OF RANGE
P.OV1 EQU *
LDA X1
CMP #>320
LDA X1+1
SBC #<320
BCC P.OV2
RTS ;LEAVE OUT OF RANGE
;WORKS UP TO HERE
;
;CALCULATE COLUMN
P.OV2 EQU *
LDA X1+1
LSR
STA _T+15
LDA X1
ROR
LSR ;/ BY 8
LSR
STA _T+14
;CALCULATE Y*8+COLUMN
LDA Y1
ASL
STA HOLDIT
LDA Y1+1
ROL
STA HOLDIT+1
ASL HOLDIT
ROL HOLDIT+1
ASL HOLDIT
ROL HOLDIT+1
CLC
LDA _T+14 ;ADD THE COLUMN
ADC HOLDIT ;TO THE Y*8
STA _T+14
LDA _T+15
ADC HOLDIT+1
STA _T+15
;NOW ADD THAT TO Y*32
LDA Y1
ASL ;1ST
STA HOLDIT
LDA Y1+1
ROL ;1ST
STA HOLDIT+1
ASL HOLDIT ;2ND
ROL HOLDIT+1 ;2ND
ASL HOLDIT ;3RD
ROL HOLDIT+1 ;3RD
ASL HOLDIT ;4TH
ROL HOLDIT+1 ;4TH
ASL HOLDIT ;5TH
ROL HOLDIT+1 ;*32
CLC
LDA _T+14
ADC HOLDIT
STA _T+14
LDA _T+15
ADC HOLDIT+1
STA _T+15
;ADD THIS DIS. TO SCREEN ADR.
CLC
LDA _T+14
ADC $58
STA _T+14
LDA _T+15
ADC $59
STA _T+15
;GET THE BIT PATTERN TO AND TO SCREEN
LDY #5
LDA (_SP),Y
AND #1
BNE P.COL1
LDA X1
AND #$07
TAY
LDA MASK,Y
LDY #0
AND (_T+14),Y
STA (_T+14),Y
RTS
;
P.COL1 LDA X1
AND #$07
TAY
LDA BITS,Y
LDY #0
ORA (_T+14),Y
STA (_T+14),Y
RTS
HOLDIT DW 0
MASK DB $7F,$BF,$DF,$EF,$F7,$FB,$FD,$FE
BITS DB $80,$40,$20,$10,$08,$04,$02,$01
#
PROCEDURE LINETO(X,Y,COLOR:INTEGER);
BEGIN
#A
J EQU _T+2
I EQU J+2
DX EQU I+2
DY EQU DX+2
XDIR EQU DY+2
YDIR EQU XDIR+2
SEC
LDY #7+2
LDA (_SP),Y
SBC X1
STA DX
LDY #8+2
LDA (_SP),Y
SBC X1+1
STA DX+1
;
SEC
LDY #5+2
LDA (_SP),Y
SBC Y1
STA DY
LDY #6+2
LDA (_SP),Y
SBC Y1+1
STA DY+1
;
LDA #>1
STA XDIR
LDA #<1
STA XDIR+1
LDA DX+1
BPL DRAW1
SEC
LDA #0
SBC DX
STA DX
LDA #0
SBC DX+1
STA DX+1
LDA #>-1
STA XDIR
LDA #<-1
STA XDIR+1
;
DRAW1 LDA #>1
STA YDIR
LDA #<1
STA YDIR+1
LDA DY+1
BPL DRAW2
SEC
LDA #0
SBC DY
STA DY
LDA #0
SBC DY+1
STA DY+1
LDA #>-1
STA YDIR
LDA #<-1
STA YDIR+1
;
DRAW2 LDY #7+2
LDA (_SP),Y
STA _T
LDA X1
STA (_SP),Y
LDA _T
STA X1
INY
LDA (_SP),Y
STA _T
LDA X1+1
STA (_SP),Y
LDA _T
STA X1+1
LDY #5+2
LDA (_SP),Y
STA _T
LDA Y1
STA (_SP),Y
LDA _T
STA Y1
INY
LDA (_SP),Y
STA _T
LDA Y1+1
STA (_SP),Y
LDA _T
STA Y1+1
;
LDA DX
CMP DY
LDA DX+1
SBC DY+1
BCC DRAW3
;
LDA DX+1
STA I+1
LSR A
STA J+1
LDA DX
STA I
ROR A
STA J
;
DRAW4 LDA J
CMP DX
LDA J+1
SBC DX+1
BCC DRAW5
;
SEC
LDA J
SBC DX
STA J
LDA J+1
SBC DX+1
STA J+1
;
CLC
LDY #5+2
LDA (_SP),Y
ADC YDIR
STA (_SP),Y
LDY #6+2
LDA (_SP),Y
ADC YDIR+1
STA (_SP),Y
;
DRAW5 CLC
LDA J
ADC DY
STA J
LDA J+1
ADC DY+1
STA J+1
;
JSR PLOT
;
CLC
LDY #7+2
LDA (_SP),Y
ADC XDIR
STA (_SP),Y
LDY #8+2
LDA (_SP),Y
ADC XDIR+1
STA (_SP),Y
;
CLC
LDA I
ADC #>-1
STA I
LDA I+1
ADC #<-1
STA I+1
BPL DRAW4
DRAWEX EQU *
#
END;
#A
DRAW3 LDA DY+1
STA I+1
LSR A
STA J+1
LDA DY
STA I
ROR A
STA J
;
DRAW6 LDA J
CMP DY
LDA J+1
SBC DY+1
BCC DRAW7
;
SEC
LDA J
SBC DY
STA J
LDA J+1
SBC DY+1
STA J+1
;
CLC
LDY #7+2
LDA (_SP),Y
ADC XDIR
STA (_SP),Y
LDY #8+2
LDA (_SP),Y
ADC XDIR+1
STA (_SP),Y
;
DRAW7 CLC
LDA J
ADC DX
STA J
LDA J+1
ADC DX+1
STA J+1
;
JSR PLOT
;
CLC
LDY #5+2
LDA (_SP),Y
ADC YDIR
STA (_SP),Y
LDY #6+2
LDA (_SP),Y
ADC YDIR+1
STA (_SP),Y
;
CLC
LDA I
ADC #>-1
STA I
LDA I+1
ADC #<-1
STA I+1
BPL DRAW6
BMI DRAWEX
;
X1 DW 0
Y1 DW 0
#
PROCEDURE MOVE(X,Y:INTEGER);
BEGIN
#A
LDY #5
LDA (_SP),Y
STA Y1
INY
LDA (_SP),Y
STA Y1+1
INY
LDA (_SP),Y
STA X1
INY
LDA (_SP),Y
STA X1+1
#
END;
No comments:
Post a Comment