💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › apple8 › Pgms › ZBLOC… captured on 2023-01-29 at 10:53:45.
View Raw
More Information
-=-=-=-=-=-=-
- **************************************************
- *
- ZBLOCK SOURCE *
- *
- A GRAPHICS BLOCK KLIP/DISPLAY ROUTINE FOR *
- THE APPLE HIRES SCREEN AND ZBASIC COMPILER *
- *
- Currently editing for data storage/retrieval *
- from a ZBASIC string field, or data structure *
- in the following format: *
- byte # data value *
- ------ ---------- *
- 0 str-len (data size) *
- (not used) *
- 1 byte width (7 pixel/byte) *
- 2 byte length (pixel lines) *
- 3+ data bytes (255 max/str) *
- 'Modified from the original BLOCK' code from *
- NIBBLE VOL.12/#2 *
- *
- Last Edit 20/may/93 *
- *
- Edasm-Prodos - Zbasic 4.0 *
- *
- **************************************************
- EQUATES *
TBLSTART EQU $06 ;START OF SHAPE
COUNTER EQU $08 ;# LINES COMPLETED
PNTR EQU $0B ;SCREEN POINTER
YNOW EQU $0D ;CURRENT LINE
SCREEN EQU $26 ;HPOSN RETURNS THIS
WIDTH EQU $FB
HEIGHT EQU $FC
XSTART EQU $FD
YSTART EQU $FE
MODE EQU $FF ;TRANSFER MODE
ORG $9F00
DRAW JMP DRAW1 ;CALL TABLE
XDRAW JMP XDRAW1 ;AVOIDS AN EXTRA
ADRAW JMP ADRAW1 ;POKE THIS WAY
ODRAW JMP ODRAW1 ;
CLIP JMP CLIP1 ;
POINT JMP POINT1 ;COLUMN BASED PNTR
DRAW1 LDA #209 ;SET DRAW MODE
STA MODE ;& CONT. SETUP
CLC
BCC SETUP
XDRAW1 LDA #81 ;SET XDRAW MODE
STA MODE ;& CONT. SETUP
CLC
BCC SETUP
ADRAW1 LDA #49 ;SET AND MODE
STA MODE ;& CONT. SETUP
CLC
BCC SETUP
ODRAW1 LDA #17 ;SET OR MODE
STA MODE
CLC
BCC SETUP
CLIP1 LDA #$91 ;SET MODE VALUE
STA MODE
INC TBLSTART ;SKIP STR LEN
LDY #0 ;STORE SHAPE
LDA WIDTH ;WIDTH & HEIGHT
STA (TBLSTART),Y ;IN ICON BUFFER
INY
LDA HEIGHT
STA (TBLSTART),Y
LDA #PNTR
STA COLUMN+1
LDA #TBLSTART
STA COLUMN+3
CLC
BCC BEGIN
POINT1 LDA #81 ;EOR MODE FOR THIS
STA MODE
LDA #>ARROW ;POINT TO ICON
STA TBLSTART
LDA #<ARROW
STA TBLSTART+1
SETUP INC TBLSTART ;SKIP STR LEN
LDY #0
LDA (TBLSTART),Y ;SET WIDTH
STA WIDTH
INY
LDA (TBLSTART),Y ;SET HEIGHT
STA HEIGHT
LDA MODE ;RESTORE MODE AND CONTINUE
STA COLUMN+2 ;STORE MODE
LDA #TBLSTART ;AND SETUP
STA COLUMN+1 ;DISP. MODULE
LDA #PNTR
STA COLUMN+3
BNE BEGIN ;ALWAYS TAKEN
BEGIN LDA YSTART ;GET LINE TO START ON
STA YNOW ;AND PRESERVE
LDA #$00
STA COUNTER ;INIT COUNTER
ROW LDA YNOW ;CURRENT Y VALUE
LDX #$00 ;XLSB
LDY #$00 ;XMSB
JSR HPOSN ;CALC ADDR
CLC
LDA SCREEN ;ADJUST FOR X POS.
ADC XSTART
STA PNTR
LDA SCREEN+1
ADC #$00
STA PNTR+1
LDY #$00
- THIS CODE CHANGES BY TRANSFER MODES
COLUMN LDA (TBLSTART),Y
ORA (PNTR),Y
STA (PNTR),Y
INY
CPY WIDTH ;FINISHED ROW
BCC COLUMN ;NO, DO NEXT COLUMN
CLC ;INC PNTRS TO NEXT ROW
LDA TBLSTART
ADC WIDTH
STA TBLSTART
LDA #$00
ADC TBLSTART+1
STA TBLSTART+1
INC YNOW ;NEXT ROW #
INC COUNTER
LDA COUNTER
CMP HEIGHT
BNE ROW
RTS
HPOSN TAY
LDA TABLE.LO,Y
STA SCREEN
LDA TABLE.HI,Y
STA SCREEN+1
RTS
- ##### DEFINE ARROW BITMAP #####
ARROW DB 0
DB 1
;WIDT
DB 8 ;HEIGHT
DB %01100000
DB %01110000
DB %01111000
DB %01111100
DB %01111110
DB %00001100
DB %00000110
DB %00000011
- ##### DEFINE THE HIRES LOOKUP TABLES #####
TABLE.HI DB $20,$24,$28,$2C,$30,$34,$38,$3C,$20
DB $24,$28,$2C,$30,$34,$38,$3C,$21,$25,$29
DB $2D,$31,$35,$39,$3D,$21,$25,$29,$2D,$31,$35
DB $39,$3D,$22,$26,$2A,$2E,$32,$36,$3A,$3E,$22
DB $26,$2A,$2E,$32,$36,$3A,$3E,$23,$27,$2B,$2F
DB $33,$37,$3B,$3F,$23,$27,$2B,$2F,$33,$37,$3B
DB $3F,$20,$24,$28,$2C,$30,$34,$38,$3C,$20,$24
DB $28,$2C,$30,$34,$38,$3C,$21,$25,$29,$2D,$31
DB $35,$39,$3D,$21,$25,$29,$2D,$31,$35,$39,$3D
DB $22,$26,$2A,$2E,$32,$36,$3A,$3E,$22,$26,$2A
DB $2E,$32,$36,$3A,$3E,$23,$27,$2B,$2F,$33,$37
DB $3B,$3F,$23,$27,$2B,$2F,$33,$37,$3B,$3F,$20
DB $24,$28,$2C,$30,$34,$38,$3C,$20,$24,$28,$2C
DB $30,$34,$38,$3C,$21,$25,$29,$2D,$31,$35,$39
DB $3D,$21,$25,$29,$2D,$31,$35,$39,$3D,$22,$26
DB $2A,$2E,$32,$36,$3A,$3E,$22,$26,$2A,$2E,$32
DB $36,$3A,$3E,$23,$27,$2B,$2F,$33,$37,$3B,$3F
DB $23,$27,$2B,$2F,$33,$37,$3B,$3F
TABLE.LO DB $00,$00,$00,$00,$00,$00,$00,$00,$80
DB $80,$80,$80,$80,$80,$80,$80,$00,$00,$00
DB $00,$00,$00,$00,$00,$80,$80,$80,$80,$80,$80
DB $80,$80,$00,$00,$00,$00,$00,$00,$00,$00,$80
DB $80,$80,$80,$80,$80,$80,$80,$00,$00,$00,$00
DB $00,$00,$00,$00,$80,$80,$80,$80,$80,$80,$80
DB $80,$28,$28,$28,$28,$28,$28,$28,$28,$A8,$A8
DB $A8,$A8,$A8,$A8,$A8,$A8,$28,$28,$28,$28,$28
DB $28,$28,$28,$A8,$A8,$A8,$A8,$A8,$A8,$A8,$A8
DB $28,$28,$28,$28,$28,$28,$28,$28,$A8,$A8,$A8
DB $A8,$A8,$A8,$A8,$A8,$28,$28,$28,$28,$28,$28
DB $28,$28,$A8,$A8,$A8,$A8,$A8,$A8,$A8,$A8,$50
DB $50,$50,$50,$50,$50,$50,$50,$D0,$D0,$D0,$D0
DB $D0,$D0,$D0,$D0,$50,$50,$50,$50,$50,$50,$50
DB $50,$D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0,$50,$50
DB $50,$50,$50,$50,$50,$50,$D0,$D0,$D0,$D0,$D0
DB $D0,$D0,$D0,$50,$50,$50,$50,$50,$50,$50,$50
DB $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0