mirror of
https://github.com/RevCurtisP/C02.git
synced 2025-02-21 03:29:25 +00:00
Completed and Tested Vera Layer Module
This commit is contained in:
parent
7645862022
commit
de56780b03
@ -1,214 +1,14 @@
|
|||||||
; C02 module vera.h02 assembly language subroutines
|
; C02 module vera.h02 assembly language subroutines
|
||||||
|
|
||||||
;getmod() - Get Layer 0/1 Mode
|
;Vera Internal Address Space
|
||||||
;Args: A = Layer (0/1)
|
;$00000-$1FFFF Video RAM
|
||||||
;Affects: Y
|
;$F0000-$F001F Display composer Registers
|
||||||
;Returns: A = Layer Mode
|
;$F1000-$F11FF Palette
|
||||||
; X = Current Data Port
|
;$F2000-$F200F Layer 0 Registers
|
||||||
GETMOD: JSR GETLRC ;Read Register
|
;$F3000-$F300F Layer 1 Registers
|
||||||
LSR ;Shift Left Five Bits
|
;$F4000-$F400F Sprite Registers
|
||||||
LSR
|
;$F5000-$F53FF Sprite Attributes
|
||||||
LSR
|
;$F6000- Audio
|
||||||
LSR
|
;$F7000-$F7001 SPI
|
||||||
RTS
|
;$F8000-$F8003 UART
|
||||||
|
|
||||||
;getenb() - Get Layer 0/1 Enabled
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Affects: Y
|
|
||||||
;Returns: A = $FF - Layer Enabled
|
|
||||||
; $00 - Layer Disabled
|
|
||||||
; X = Current Data Port
|
|
||||||
GETENB: JSR GETLRC ;Read Register
|
|
||||||
AND #$01 ;Isolate Bit 1
|
|
||||||
BEQ GETENX ;If Set
|
|
||||||
LDA #$FF ; Return TRUE
|
|
||||||
GETENX: RTS ;Else Return FALSE
|
|
||||||
|
|
||||||
;getlrc() - Get Layer 0/1 Control Register
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Affects: Y
|
|
||||||
;Returns: A = Control Register Contents
|
|
||||||
; X = Current Data Port
|
|
||||||
GETLRC: LDX #0 ;Set Offset to Control Register
|
|
||||||
|
|
||||||
;getlrr() - Get Layer 0/1 Register
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; X = Register Offset
|
|
||||||
;Affects: Y
|
|
||||||
;Returns: A = Contents of Register
|
|
||||||
; X = Current Data Port
|
|
||||||
GETLRR: JSR GETLRP ;Get Layer Page in Y
|
|
||||||
JMP GETREG ;and Read Register Contents
|
|
||||||
|
|
||||||
;getlrp() - Get Layer 0/1 Register Page
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Returns: A,Y = Layer Register Page
|
|
||||||
GETLRP: AND #$01 ;Isolate Bit 1
|
|
||||||
ASL ;Move to Left Nybble
|
|
||||||
ASL
|
|
||||||
ASL
|
|
||||||
ASL
|
|
||||||
ORA #$20 ;And Add to 2
|
|
||||||
TAY ;Return Page in Y
|
|
||||||
RTS
|
|
||||||
|
|
||||||
;getchd(index, &array) - Read Character Data into Array
|
|
||||||
;Args: A = Character Index
|
|
||||||
; Y,X = Address of Array to Read into
|
|
||||||
;Destroys: TEMP0,TEMP1,TEMP2
|
|
||||||
;Returns: A = Number of Bytes Read
|
|
||||||
GETCHD: JSR SETDST ;Store Address in Destination Pointer
|
|
||||||
STA TEMP1 ;Set Offset LSB to Index
|
|
||||||
LDA #0 ;Set Offset MSB to Zero
|
|
||||||
ASL TEMP1 ;Multiple Offset by 2
|
|
||||||
ROL
|
|
||||||
STA TEMP2 ;and Store MSB
|
|
||||||
JSR GETLRI ;Get Tile Base
|
|
||||||
TXA ;Add Offset To Tile Base
|
|
||||||
CLC
|
|
||||||
ADC TEMP0
|
|
||||||
STA TEMP0
|
|
||||||
TYA
|
|
||||||
ADC TEMP1
|
|
||||||
STA TEMP1
|
|
||||||
LDA #0
|
|
||||||
ADC #0
|
|
||||||
JSR GETMBX ;Multiply by 4
|
|
||||||
ORA #$10 ;Set Auto-Increment to 1
|
|
||||||
JSR SETADR ;and Set Vera Address
|
|
||||||
LDA #8 ;Set Byte Count to 8
|
|
||||||
JMP GETMEA ;and Read Bytes into Array
|
|
||||||
|
|
||||||
;gettba() - Get Layer 0/1 Tile Base Address
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Destroys: TEMP1,TEMP2
|
|
||||||
;Returns: A = Tile Base Bank
|
|
||||||
; Y,X = Tile Base Address
|
|
||||||
GETTBA: LDX #4 ;Set Register Offset
|
|
||||||
.DC $2C ;Read Register Pair and Rotate
|
|
||||||
|
|
||||||
;getmba() - Get Layer 0/1 Map Base Address
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Destroys: TEMP1,TEMP2
|
|
||||||
;Returns: A = Map Base Bank
|
|
||||||
; Y,X = Map Base Address
|
|
||||||
GETMBA: LDX #2 ;Set Register Offset
|
|
||||||
JSR GETLRI ;Read Register Pair as Integer
|
|
||||||
LDA #0 ;Initialize Page to 0
|
|
||||||
JSR SAVRXY ;Save Integer in TEMP1,TEMP2
|
|
||||||
GETMBX: LDX #2 ;Do Twice
|
|
||||||
GETMBL: ASL TEMP1 ; Rotate LSB
|
|
||||||
ROL TEMP2 ; MSB and
|
|
||||||
ROL ; Bank Left
|
|
||||||
DEX
|
|
||||||
BNE GETMBL
|
|
||||||
JMP RESRXY ;Load LSB, MSB and Return
|
|
||||||
|
|
||||||
;getvsc() - Get Layer 0/1 Vertical Scroll
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Returns: A,X = Vertical Scroll LSB
|
|
||||||
; Y = Vertical Scroll MSB
|
|
||||||
GETVSC: LDX #8 ;Set Register Offset
|
|
||||||
.DC $2C ;Skip to GETLRI (BIT Absolute)
|
|
||||||
|
|
||||||
;gethsc() - Get Layer 0/1 Horizontal Scroll
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Returns: A,X = Horizontal Scroll LSB
|
|
||||||
; Y = Horizontal Scroll MSB
|
|
||||||
GETHSC: LDX #6 ;Set Register Offset
|
|
||||||
.DC $2C ;Skip to GETLRI (BIT Absolute)
|
|
||||||
|
|
||||||
;gettbs() - Get Layer 0/1 Tile Base
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Returns: A,X = Tile Base LSB
|
|
||||||
; Y = Tile Base MSB
|
|
||||||
GETTBS: LDX #4 ;Set Register Offset
|
|
||||||
.DC $2C ;Skip to GETLRI (BIT Absolute)
|
|
||||||
|
|
||||||
;getmbs() - Get Layer 0/1 Map Base
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Returns: A,X = Map Base LSB
|
|
||||||
; Y = Map Base MSB
|
|
||||||
GETMBS: LDX #2 ;Set Register Offset
|
|
||||||
|
|
||||||
;getlri() - Get Layer 0/1 Register Pair as Integer
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; X = Register Offset
|
|
||||||
;Returns: A,X = Integer LSB
|
|
||||||
; Y = Integer LSB
|
|
||||||
GETLRI: JSR GETLRP ;Get Layer Page in Y
|
|
||||||
JMP GETREI ;and Read Register Contents
|
|
||||||
|
|
||||||
;mapsiz() - Convert Map Size Specifier to Pixels
|
|
||||||
;Args: A = Map Size Specifier
|
|
||||||
;Affects: A
|
|
||||||
;Returns: Y,X Map Size in Pixels
|
|
||||||
MAPSIZ: TAX ;Copy Map Size Specifier to X
|
|
||||||
LDA MAPSIH,X ;Load Pixels MSB from Table
|
|
||||||
TAY ;and Return in Y
|
|
||||||
LDA MAPSIL,X ;Load Pixels LSB from Table
|
|
||||||
TAX ;and Return in X
|
|
||||||
MAPSIL: .DC $20,$40,$80,$00
|
|
||||||
MAPSIH: .DC $00,$00,$00,$01
|
|
||||||
|
|
||||||
;tilsiz() - Convert Tile Size Specifier to Pixels
|
|
||||||
;Args: A = Tile Size Specifier
|
|
||||||
;Affects: A
|
|
||||||
;Returns: A Tile Size in Pixels
|
|
||||||
TILSIZ: TAX ;Copy Map Size Specifier to X
|
|
||||||
LDA TILSIT,X ;Load Pixels MSB from Table
|
|
||||||
RTS
|
|
||||||
TILSIT: .DC $08,$10
|
|
||||||
|
|
||||||
;gettsz() - Get Layer 0/1 Tile Size
|
|
||||||
|
|
||||||
;getmsz() - Get Layer 0/1 Map Size
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
;Affects: X
|
|
||||||
;Returns: A = Map Width Specifier
|
|
||||||
; Y = Map Height Specifier
|
|
||||||
|
|
||||||
;settbs() - Set Layer 0/1 Map Base
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; Y,X = Map Base
|
|
||||||
;Sets: TEMP1,TEMP2 = Map Base
|
|
||||||
;Affecta: A,Y,X
|
|
||||||
SETTBS: JSR SAVRXY ;Store Map Base in TEMP1,TEMP2
|
|
||||||
LDX #4 ;Set Register Offset
|
|
||||||
BNE SETLRI ;Write to Layer Register
|
|
||||||
|
|
||||||
;setmbs() - Set Layer 0/1 Map Base
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; Y,X = Map Base
|
|
||||||
;Sets: TEMP1,TEMP2 = Map Base
|
|
||||||
;Affecta: A,Y,X
|
|
||||||
SETMBS: JSR SAVRXY ;Store Map Base in TEMP1,TEMP2
|
|
||||||
LDX #2 ;Set Register Offset
|
|
||||||
BNE SETLRI ;Write to Layer Register
|
|
||||||
|
|
||||||
;setvsc() - Set Layer 0/1 Vertical Scroll
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; Y,X = Map Base
|
|
||||||
;Sets: TEMP1,TEMP2 = Vertical Scroll
|
|
||||||
;Affecta: A,Y,X
|
|
||||||
SETVSC: JSR SAVRXY ;Store Vertical Scroll in TEMP1,TEMP2
|
|
||||||
LDX #8 ;Set Register Offset
|
|
||||||
BNE SETLRI ;Write to Layer Register
|
|
||||||
|
|
||||||
;sethsc() - Set Layer 0/1 Horizontal Scroll
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; Y,X = Map Base
|
|
||||||
;Sets: TEMP1,TEMP2 = Horizontal Scroll
|
|
||||||
;Affecta: A,Y,X
|
|
||||||
SETHSC: JSR SAVRXY ;Store Horizontal Scroll in TEMP1,TEMP2
|
|
||||||
LDX #6 ;Set Register Offset
|
|
||||||
|
|
||||||
;setlri() - Write Integer to Get Layer 0/1 Register
|
|
||||||
;Args: A = Layer (0/1)
|
|
||||||
; X = Register Offset
|
|
||||||
;Uses: TEMP1,TEMP2 = Integer Value
|
|
||||||
;Affecta: A,Y,X
|
|
||||||
SETLRI: JSR GETLRP ;Get Layer Page in Y
|
|
||||||
JMP SETREI ;and Write Integer to Register
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
; Requires External Routines NYBCAT, NYBCUT, REGADR, and SAVRXY
|
; Requires External Routines NYBCAT, NYBCUT, REGADR, and SAVRXY
|
||||||
; and External Variables TEMP1 and TEMP2
|
; and External Variables TEMP1 and TEMP2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;rgbclr(r,g,b) - Convert RGB Values to Palette Color
|
;rgbclr(r,g,b) - Convert RGB Values to Palette Color
|
||||||
;Args: A = Red Value (0-15)
|
;Args: A = Red Value (0-15)
|
||||||
; Y = Green Value (0-15)
|
; Y = Green Value (0-15)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/***************************************************
|
/*********************************************
|
||||||
* vera.h02 - Commander X16 Routines for Vera chip *
|
* veraclr.h02 - Color Palette functions for *
|
||||||
***************************************************/
|
* Commander X16 VERA Chip *
|
||||||
|
*********************************************/
|
||||||
|
|
||||||
/* Convert Palette Color Value *
|
/* Convert Palette Color Value *
|
||||||
* to R, G, and B Values *
|
* to R, G, and B Values *
|
||||||
|
@ -1,19 +1,46 @@
|
|||||||
; Vera Display Composer Assembly Language Routines for C02
|
; Vera Display Composer Assembly Language Routines for C02
|
||||||
; Requires External Routines GETDCR and SETDCX
|
; Requires External Routines GETVRG and SETDCX, SETDST
|
||||||
; and External Variables TEMP0, TEMP1, and TEMP2
|
; and External Variables TEMP0, TEMP1, and TEMP2
|
||||||
|
|
||||||
;getbdr() - Get Get Border Color
|
;Display Composer Registers
|
||||||
|
;$F0000 Video Control
|
||||||
|
;$F0001 Horizontal Scale
|
||||||
|
;$F0002 Vertical Scale
|
||||||
|
;$F0003 Border Color
|
||||||
|
;$F0004 Horizontal Start LSB
|
||||||
|
;$F0005 Horizontal Stop LSB
|
||||||
|
;$F0006 Vertical Start LSB
|
||||||
|
;$F0007 Vertical Stop LSB
|
||||||
|
;$F0008 Start/Stop High Bits
|
||||||
|
;$F0009 IRQ Line LSB
|
||||||
|
;$F000A IRQ Line MSB
|
||||||
|
|
||||||
|
;getbdr() - Get Border Color
|
||||||
;Returns: A = Border Color Palette Index
|
;Returns: A = Border Color Palette Index
|
||||||
GETBDR: LDA #$03 ;Set Register Offset to Border Color
|
GETBDR: LDA #$03 ;Set Register Offset to Border Color
|
||||||
|
|
||||||
;getdcr() - Get Display Composer Register
|
;getdcb(reg) - Read Single Display Composer Register
|
||||||
;Args: A = Register Offset
|
;Args: A = Register Offset
|
||||||
;Affects: Y
|
;Affects: Y
|
||||||
;Returns: A = Contents of Register
|
;Returns: A = Contents of Register
|
||||||
; X = Current Data Port
|
; X = Current Data Port
|
||||||
GETDCR: LDY #$00 ;Set MSB to Display Composer Page
|
GETDCB: LDY #$00 ;Set MSB to Display Composer Page
|
||||||
TAX ;Set LSB to Register Offset
|
TAX ;Set LSB to Register Offset
|
||||||
JMP GETREG ;and Execute GETREG
|
JMP GETVRG ;and Execute Vera Register
|
||||||
|
|
||||||
|
;getdcr(&array) - Read All Display Composer Registers
|
||||||
|
;Args: Y,X = Address of Array
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = Contents of Register
|
||||||
|
; X = Current Data Port
|
||||||
|
GETDCR: JSR SETDST ;Set Destination Pointer to Array
|
||||||
|
JSR SETDCA ;Set Address to Display Composer
|
||||||
|
LDA #11 ;Set Number of Registers to 11
|
||||||
|
JMP GETMEA ;and Read Registers
|
||||||
|
|
||||||
|
SETDCA: LDY #00 ;Set Page to Display Composer
|
||||||
|
LDX #0 ;Set Register to 0
|
||||||
|
JMP REGADR ;Set Vera Address to Register
|
||||||
|
|
||||||
;getiql() - Get Interrupt Line
|
;getiql() - Get Interrupt Line
|
||||||
;Affects: A
|
;Affects: A
|
||||||
@ -33,14 +60,14 @@ GETSCL: LDA #1 ;Set Register Offset to HSCALE,VSCALE
|
|||||||
; Y = Integer LSB
|
; Y = Integer LSB
|
||||||
GETDCI: LDY #$00 ;Set MSB to Display Composer Page
|
GETDCI: LDY #$00 ;Set MSB to Display Composer Page
|
||||||
TAX ;Set LSB to Register Offset
|
TAX ;Set LSB to Register Offset
|
||||||
JMP GETREI ;Get Vera Register Pair
|
JMP GETVRI ;Get Vera Register Pair
|
||||||
|
|
||||||
;getvid() - Get Video Output Mode
|
;getvid() - Get Video Output Mode
|
||||||
;Returns: A = Video Mode
|
;Returns: A = Video Mode
|
||||||
; Y = Chroma Disabled
|
; Y = Chroma Disabled
|
||||||
; X = Current Field
|
; X = Current Field
|
||||||
GETVID: LDA #$00 ;Set Register Offset to Video Output
|
GETVID: LDA #$00 ;Set Register Offset to Video Output
|
||||||
JSR GETDCR ;Read from Display Composer
|
JSR GETDCB ;Read from Display Composer
|
||||||
LDY #$00 ;Set Chroma Disabled to FALSE
|
LDY #$00 ;Set Chroma Disabled to FALSE
|
||||||
LDX #$00 ;Set Video Field to EVEN
|
LDX #$00 ;Set Video Field to EVEN
|
||||||
BIT GETVIM ;Test Chroma Disabled Bit
|
BIT GETVIM ;Test Chroma Disabled Bit
|
||||||
@ -97,7 +124,7 @@ GETHSS: AND #$03 ;Isolate Bit 0
|
|||||||
;Affects: Y
|
;Affects: Y
|
||||||
;Returns: A = High Bits
|
;Returns: A = High Bits
|
||||||
; X = Low Byte
|
; X = Low Byte
|
||||||
GETHVS: JSR GETDCR ;Read LSB from Register
|
GETHVS: JSR GETDCB ;Read LSB from Register
|
||||||
PHA ;and Save It
|
PHA ;and Save It
|
||||||
LDA #8 ;Load Register Offset for High Bits
|
LDA #8 ;Load Register Offset for High Bits
|
||||||
STA $9F20 ;Set As Address LSB
|
STA $9F20 ;Set As Address LSB
|
||||||
@ -183,7 +210,7 @@ SETHSR: TYA ;Convert MSB to High Bits
|
|||||||
LDX #4 ;Set Register Offset to Horizontal Start
|
LDX #4 ;Set Register Offset to Horizontal Start
|
||||||
LDY #$FC ;Set High Bits Mask
|
LDY #$FC ;Set High Bits Mask
|
||||||
|
|
||||||
;sethvs() - Set Horizontal/Vertial Start/Stop
|
;sethvs() - Set Horizontal/Vertical Start/Stop
|
||||||
;Args: A = Start/Stop LSB
|
;Args: A = Start/Stop LSB
|
||||||
; Y = High Bits and Mask
|
; Y = High Bits and Mask
|
||||||
; X = LSB Register Offset
|
; X = LSB Register Offset
|
||||||
|
@ -1,26 +1,29 @@
|
|||||||
/*********************************************
|
/*********************************************
|
||||||
* veradsp.h02 - Display Composer Functions *
|
* veradsp.h02 - Display Composer Functions *
|
||||||
* Commander X16 VERA Chip *
|
* Commander X16 VERA Chip *
|
||||||
|
* Requires: x16.h02 *
|
||||||
|
* stddef.h02 *
|
||||||
|
* veramem.h02 *
|
||||||
*********************************************/
|
*********************************************/
|
||||||
|
|
||||||
/* Get Border Color *
|
/* Get Border Color *
|
||||||
* Returns: char i = Color Index */
|
* Returns: char i - Color Index */
|
||||||
char getbdr();
|
char getbdr();
|
||||||
|
|
||||||
/* Get Horizontal Stop *
|
/* Get Horizontal Stop *
|
||||||
* Returns: int i = Horizontal Stop */
|
* Returns: int i - Horizontal Stop */
|
||||||
char gethsp();
|
char gethsp();
|
||||||
|
|
||||||
/* Get Horizontal Start *
|
/* Get Horizontal Start *
|
||||||
* Returns: int i = Horizontal Start */
|
* Returns: int i - Horizontal Start */
|
||||||
char gethsr();
|
char gethsr();
|
||||||
|
|
||||||
/* Get IRQ Line *
|
/* Get IRQ Line *
|
||||||
* Returns: int i = IRQ Line */
|
* Returns: int i - IRQ Line */
|
||||||
char getiql();
|
char getiql();
|
||||||
|
|
||||||
/* Get Horizontal and Vertical Scale *
|
/* Get Horizontal and Vertical Scale *
|
||||||
* Returns: char h = Horizontal Scale *
|
* Returns: char h - Horizontal Scale *
|
||||||
* char v - Vertical Scale */
|
* char v - Vertical Scale */
|
||||||
char getscl();
|
char getscl();
|
||||||
|
|
||||||
@ -31,32 +34,32 @@ char getscl();
|
|||||||
char getvid();
|
char getvid();
|
||||||
|
|
||||||
/* Get Vertical Stop *
|
/* Get Vertical Stop *
|
||||||
* Returns: int i = Vertical Stop */
|
* Returns: int i - Vertical Stop */
|
||||||
char getvsp();
|
char getvsp();
|
||||||
|
|
||||||
/* Get Vertical Start *
|
/* Get Vertical Start *
|
||||||
* Returns: int i = Vertical Start */
|
* Returns: int i - Vertical Start */
|
||||||
char getvsr();
|
char getvsr();
|
||||||
|
|
||||||
/* Set Border Color *
|
/* Set Border Color *
|
||||||
* Args: char i = Color Index */
|
* Args: char i - Color Index */
|
||||||
char setbdr();
|
char setbdr();
|
||||||
|
|
||||||
/* Set Horizontal Stop *
|
/* Set Horizontal Stop *
|
||||||
* Args: int i = Horizontal Stop */
|
* Args: int i - Horizontal Stop */
|
||||||
char sethsp();
|
char sethsp();
|
||||||
|
|
||||||
/* Set Horizontal Start *
|
/* Set Horizontal Start *
|
||||||
* Args: int i = Horizontal Start */
|
* Args: int i - Horizontal Start */
|
||||||
char sethsr();
|
char sethsr();
|
||||||
|
|
||||||
/* set IRQ Line *
|
/* set IRQ Line *
|
||||||
* Args: int i = IRQ Line */
|
* Args: int i - IRQ Line */
|
||||||
char setiql();
|
char setiql();
|
||||||
|
|
||||||
/* Set Horizontal and Vertical Scale *
|
/* Set Horizontal and Vertical Scale *
|
||||||
* Args: char h = Horizontal Scale *
|
* Args: char h - Horizontal Scale *
|
||||||
* char v - Vertical Scale */
|
* char v - Vertical Scale */
|
||||||
char setscl();
|
char setscl();
|
||||||
|
|
||||||
/* Set Video Output Mode *
|
/* Set Video Output Mode *
|
||||||
@ -65,9 +68,9 @@ char setscl();
|
|||||||
char setvid();
|
char setvid();
|
||||||
|
|
||||||
/* Set Vertical Stop *
|
/* Set Vertical Stop *
|
||||||
* Args: int i = Vertical Stop */
|
* Args: int i - Vertical Stop */
|
||||||
char setvsp();
|
char setvsp();
|
||||||
|
|
||||||
/* Set Vertical Start *
|
/* Set Vertical Start *
|
||||||
* Args: int i = Vertical Start */
|
* Args: int i - Vertical Start */
|
||||||
char setvsr();
|
char setvsr();
|
||||||
|
385
x16/include/veralyr.a02
Normal file
385
x16/include/veralyr.a02
Normal file
@ -0,0 +1,385 @@
|
|||||||
|
; Vera Layer Control Assembly Language Routines for C02
|
||||||
|
; Requires External Routines GETVRG, GETVRI, RESRXY, SAVREG, SAVRXY
|
||||||
|
; and External Variables TEMP0, TEMP1, TEMP2, TEMP3
|
||||||
|
|
||||||
|
;Layer 0/1 Registers
|
||||||
|
;$F2000/$F3000 Layer Control (Mode and Enabled)
|
||||||
|
;$F2001/$F3001 Tile and Map Height and Width
|
||||||
|
;$F2002/$F3002 Map Base Bits 9-2
|
||||||
|
;$F2003/$F3003 Map Base Bits 17-10
|
||||||
|
;$F2004/$F3004 Tile Base Bits 9-2
|
||||||
|
;$F2005/$F3005 Tile Base Bits 17-10
|
||||||
|
;$F2006/$F3006 Horizontal Scroll LSB
|
||||||
|
;$F2007/$F3007 Horizontal Scroll MSB or Bitmap Palette Offset
|
||||||
|
;$F2008/$F3008 Vertical Scroll LSB
|
||||||
|
;$F2009/$F3009 Vertical Scroll MSB
|
||||||
|
|
||||||
|
;getbpo(lyr) - Get Bitmap Palette Offset
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: Y
|
||||||
|
;Sets: TEMP3 = Register Offset
|
||||||
|
;Returns: A = Control Register Contents
|
||||||
|
; X = Current Data Port
|
||||||
|
GETBPO: LDX #7 ;Set Offset to Bitmap Palette Offset
|
||||||
|
JSR GETLRR ;Read Register
|
||||||
|
ASL ;and Multiply by 16
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;getlrs(lyr) - Get Layer 0/1 Size Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: Y
|
||||||
|
;Sets: TEMP3 = Register Offset
|
||||||
|
;Returns: A = Size Register Contents
|
||||||
|
; X = Current Data Port
|
||||||
|
GETLRS: LDX #1 ;Set Offset to Size Register
|
||||||
|
.DC $2C ;Skip to GETLRR (BIT Absolute)
|
||||||
|
|
||||||
|
;getlrc(lyr) - Get Layer 0/1 Control Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: Y
|
||||||
|
;Sets: TEMP3 = Register Offset
|
||||||
|
;Returns: A = Control Register Contents
|
||||||
|
; X = Current Data Port
|
||||||
|
GETLRC: LDX #0 ;Set Offset to Control Register
|
||||||
|
|
||||||
|
|
||||||
|
;getlrr() - Get Layer 0/1 Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; X = Register Offset
|
||||||
|
;Sets: TEMP3 = Register Offset
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = Contents of Register
|
||||||
|
; X = Current Data Port
|
||||||
|
GETLRR: STX TEMP3 ;Save Register Offset
|
||||||
|
JSR GETLRP ;Get Layer Page in Y
|
||||||
|
JMP GETVRG ;and Read Vera Register
|
||||||
|
|
||||||
|
;getlrp(lyr) - Get Layer 0/1 Register Page
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Returns: A,Y = Layer Register Page
|
||||||
|
GETLRP: AND #$01 ;Isolate Bit 1
|
||||||
|
ASL ;Move to Left Nybble
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
ORA #$20 ;And Add to 2
|
||||||
|
TAY ;Return Page in Y
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;getenb(lyr) - Get Layer 0/1 Enabled
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = $FF - Layer Enabled
|
||||||
|
; $00 - Layer Disabled
|
||||||
|
; X = Current Data Port
|
||||||
|
GETENB: JSR GETLRC ;Read Register
|
||||||
|
AND #$01 ;Isolate Bit 1
|
||||||
|
BEQ GETENX ;If Set
|
||||||
|
LDA #$FF ; Return TRUE
|
||||||
|
GETENX: RTS ;Else Return FALSE
|
||||||
|
|
||||||
|
;getmod(lyr) - Get Layer 0/1 Mode
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = Layer Mode
|
||||||
|
; X = Current Data Port
|
||||||
|
GETMOD: JSR GETLRC ;Read Register
|
||||||
|
LSR ;Shift Left Five Bits
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;getmsz(lyr) - Get Layer 0/1 Map Size
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: X
|
||||||
|
;Returns: A = Width Specifier
|
||||||
|
; Y = Height Specifier
|
||||||
|
GETMSZ: JSR GETLRS ;Read Size Register
|
||||||
|
TAX ;Save Contents
|
||||||
|
LSR ;Shift Right 2 Bits
|
||||||
|
LSR
|
||||||
|
AND #$03 ;Isolate Bits 0 and 1
|
||||||
|
TAY ;and Return in Y
|
||||||
|
TXA ;Restore Register Contents
|
||||||
|
AND #$03 ;Return Bits 0 and 1 in A
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;gettsz(lyr) - Get Layer 0/1 Map Size
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Affects: X
|
||||||
|
;Returns: A = Width Specifier
|
||||||
|
; Y = Height Specifier
|
||||||
|
GETTSZ: JSR GETLRS ;Read Size Register
|
||||||
|
LSR ;Shift Right 4 Bits
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
TAX ;Save Intermediate Value
|
||||||
|
LSR ;Shift Right 1 More Bit
|
||||||
|
AND #$01 ;Isolate Bit 0
|
||||||
|
TAY ;and Return in Y
|
||||||
|
TXA ;Restore Intermediate Value
|
||||||
|
AND #$01 ;and Return Bit 0 in A
|
||||||
|
RTS
|
||||||
|
|
||||||
|
;getvsc() - Get Layer 0/1 Vertical Scroll
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Returns: A,X = Vertical Scroll LSB
|
||||||
|
; Y = Vertical Scroll MSB
|
||||||
|
GETVSC: LDX #8 ;Set Register Offset
|
||||||
|
.DC $2C ;Skip to GETLRI (BIT Absolute)
|
||||||
|
|
||||||
|
;gethsc() - Get Layer 0/1 Horizontal Scroll
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Returns: A,X = Horizontal Scroll LSB
|
||||||
|
; Y = Horizontal Scroll MSB
|
||||||
|
GETHSC: LDX #6 ;Set Register Offset
|
||||||
|
.DC $2C ;Skip to GETLRI (BIT Absolute)
|
||||||
|
|
||||||
|
;gettbs() - Get Layer 0/1 Tile Base
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Returns: A,X = Tile Base LSB
|
||||||
|
; Y = Tile Base MSB
|
||||||
|
GETTBS: LDX #4 ;Set Register Offset
|
||||||
|
.DC $2C ;Skip to GETLRI (BIT Absolute)
|
||||||
|
|
||||||
|
;getmbs() - Get Layer 0/1 Map Base
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Returns: A,X = Map Base LSB
|
||||||
|
; Y = Map Base MSB
|
||||||
|
GETMBS: LDX #2 ;Set Register Offset
|
||||||
|
|
||||||
|
;getlri() - Get Layer 0/1 Register Pair as Integer
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; X = Register Offset
|
||||||
|
;Returns: A,X = Integer LSB
|
||||||
|
; Y = Integer LSB
|
||||||
|
GETLRI: JSR GETLRP ;Get Layer Page in Y
|
||||||
|
JMP GETVRI ;and Read Register Contents
|
||||||
|
|
||||||
|
;gettba() - Get Layer 0/1 Tile Base Address
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Destroys: TEMP1,TEMP2
|
||||||
|
;Returns: A = Tile Base Bank
|
||||||
|
; Y,X = Tile Base Address
|
||||||
|
GETTBA: LDX #4 ;Set Register Offset
|
||||||
|
.DC $2C ;Read Register Pair and Rotate
|
||||||
|
|
||||||
|
;getmba() - Get Layer 0/1 Map Base Address
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
;Sets: TEMP0 = Bank
|
||||||
|
; TEMP1 = Address LSB
|
||||||
|
; TEMP2 = Address MSB
|
||||||
|
;Returns: A = Map Base Bank
|
||||||
|
; Y,X = Map Base Address
|
||||||
|
GETMBA: LDX #2 ;Set Register Offset
|
||||||
|
JSR GETLRI ;Read Register Pair as Integer
|
||||||
|
LDA #0 ;Initialize Page to 0
|
||||||
|
JSR SAVREG ;Save Integer in TEMP1,TEMP2
|
||||||
|
LDX #2 ;Set Count to 2
|
||||||
|
JMP ASLADR ;and Shift Address Left
|
||||||
|
|
||||||
|
;mapsiz() - Convert Map Size Specifier to Pixels
|
||||||
|
;Args: A = Map Size Specifier
|
||||||
|
;Affects: A
|
||||||
|
;Returns: A = Shift Count
|
||||||
|
; Y,X Map Size in Pixels
|
||||||
|
MAPSIZ: TAX ;Copy Size Specifier to X
|
||||||
|
LDA MAPSIC,X ;Load Shift Count from Table
|
||||||
|
PHA ;and Save it
|
||||||
|
LDA MAPSIH,X ;Load Pixels MSB from Table
|
||||||
|
TAY ;and Return in Y
|
||||||
|
LDA MAPSIL,X ;Load Pixels LSB from Table
|
||||||
|
TAX ;and Return in X
|
||||||
|
PLA ;Return Shift Count in A
|
||||||
|
RTS
|
||||||
|
MAPSIC: .DC $05,$06,$07,$08
|
||||||
|
MAPSIL: .DC $20,$40,$80,$00
|
||||||
|
MAPSIH: .DC $00,$00,$00,$01
|
||||||
|
|
||||||
|
;tilsiz() - Convert Tile Size Specifier to Pixels
|
||||||
|
;Args: A = Tile Size Specifier
|
||||||
|
;Returns: A = Tile Size in Pixels
|
||||||
|
; Y = Shift Count
|
||||||
|
TILSIZ: TAX ;Copy Map Size Specifier to X
|
||||||
|
LDA TILSIT,X ;Return Pixels in A
|
||||||
|
LDY TILSIC,X ;and Shift Count in Y
|
||||||
|
RTS
|
||||||
|
TILSIC: .DC $03,$04
|
||||||
|
TILSIT: .DC $08,$10
|
||||||
|
|
||||||
|
;setbpo(lyr) - Set Bitmap Palette Offset
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Bitmap Palette Offset
|
||||||
|
;Affects: Y
|
||||||
|
;Sets: TEMP3 = Register Offset
|
||||||
|
;Returns: A = Control Register Contents
|
||||||
|
; X = Current Data Port
|
||||||
|
SETBPO: PHA ;Save Layer Number
|
||||||
|
TYA ;Copy Offset to Accumulator
|
||||||
|
LSR ;Divide by 16
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
LSR
|
||||||
|
TAY ;Copy Back to Y
|
||||||
|
PLA ;Restore Layer Number
|
||||||
|
LDX #7 ;Set Register Offset
|
||||||
|
BNE SETLRR ;and Write to Register
|
||||||
|
|
||||||
|
;setenb(lyr,flg) - Get Layer 0/1 Enabled
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Layer Enabled Flags
|
||||||
|
;Destroys: TEMP0
|
||||||
|
;Affects: A,X,Y
|
||||||
|
SETENB: CPY #0 ;Test Enabled Argument`
|
||||||
|
BEQ SETENZ ;If Not Zero
|
||||||
|
LDY #$01 ; Set to 1
|
||||||
|
SETENZ: LDX #$FE ;Set Control Register Mask
|
||||||
|
|
||||||
|
;setlrc(lyr,val,msk) - Set Layer 0/1 Control Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Value to Write
|
||||||
|
; X = Register Mask
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = Value Written
|
||||||
|
; X = Current Data Port
|
||||||
|
SETLRC: JSR SAVREG ;Save Layer, Value, and Mask
|
||||||
|
JSR GETLRC ;Get Layer Control Register
|
||||||
|
SETLRM: AND TEMP1 ;Apply Mask
|
||||||
|
ORA TEMP2 ;OR in Value
|
||||||
|
TAY ;and Move to Y Register
|
||||||
|
LDA TEMP0 ;Restore Layer Number
|
||||||
|
LDX TEMP3 ;Get Register Offset
|
||||||
|
|
||||||
|
;setlrr() - Set Layer 0/1 Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Value to Write
|
||||||
|
; X = Register Offset
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = Contents of Register
|
||||||
|
; X = Current Data Port
|
||||||
|
SETLRR: ;.dc $ff
|
||||||
|
.DC $5A ;PHY Save Value to Write
|
||||||
|
JSR GETLRP ;Get Layer Page in Y
|
||||||
|
PLA ;Restore Value to Write
|
||||||
|
JMP SETREG ;and Write to Register
|
||||||
|
|
||||||
|
;setlrs(lyr,val,msk) - Set Layer 0/1 Size Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
/; Y = Value to Write
|
||||||
|
; X = Register Mask
|
||||||
|
;Affects: Y
|
||||||
|
;Returns: A = Value Written
|
||||||
|
; X = Current Data Port
|
||||||
|
SETLRS: ;.dc $ff
|
||||||
|
JSR SAVREG ;Save Layer, Value, and Mask
|
||||||
|
JSR GETLRS ;Get Layer Size Register
|
||||||
|
JMP SETLRM ;Mask in Value and Write Back
|
||||||
|
|
||||||
|
;setmod() - Set Layer 0/1 Mode
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Layer Mode
|
||||||
|
;Destroys: TEMP0
|
||||||
|
;Affects: A,X,Y
|
||||||
|
SETMOD: TAX ;Save Layer Number
|
||||||
|
TYA ;Copy Mode to Accumulator
|
||||||
|
ASL ;Shift to Bits 5-7
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
TAY ;Copy Write Value to Y
|
||||||
|
TXA ;Restore Layer Number
|
||||||
|
LDX #$1F ;Set Control Register Mask
|
||||||
|
BNE SETLRC ;and Update Control Register
|
||||||
|
|
||||||
|
;setmsz(lyr) - Set Layer 0/1 Map Size
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Width Specifier
|
||||||
|
; X = Height Specifier
|
||||||
|
;Destroys: TEMP0
|
||||||
|
;Affects: A,X,Y
|
||||||
|
SETMSZ: PHA ;Save Layer Number
|
||||||
|
TXA ;Get Height Specifier
|
||||||
|
AND #$03 ;Strip High Bits
|
||||||
|
ASL ;Rotate Left 2 Bits
|
||||||
|
ASL
|
||||||
|
STA TEMP0 ;and Save It
|
||||||
|
TYA ;Get Width Specifier
|
||||||
|
AND #$03 ;Strip High Bits
|
||||||
|
ORA TEMP0 ;OR in Height Specifier
|
||||||
|
TAY ;Copy Write Value to Y
|
||||||
|
PLA ;Restore Layer Number
|
||||||
|
LDX #$F0 ;Set Size Register Mask
|
||||||
|
BNE SETLRS ;and Update Size Register
|
||||||
|
|
||||||
|
;settsz(lyr) - Set Layer 0/1 Tile Size
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y = Width Specifier
|
||||||
|
; X = Height Specifier
|
||||||
|
;Destroys: TEMP0
|
||||||
|
;Affects: A,X,Y
|
||||||
|
SETTSZ: PHA ;Save Layer Number
|
||||||
|
TXA ;Get Height Specifier
|
||||||
|
AND #$01 ;Strip High Bits
|
||||||
|
ASL ;Rotate Left 1 Bits
|
||||||
|
STA TEMP0 ;and Save It
|
||||||
|
TYA ;Get Width Specifier
|
||||||
|
AND #$01 ;Strip High Bits
|
||||||
|
ORA TEMP0 ;OR in Height Specifier
|
||||||
|
ASL ;Shift Left 4 More Bits
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
ASL
|
||||||
|
TAY ;Copy Write Value to Y
|
||||||
|
PLA ;Restore Layer Number
|
||||||
|
LDX #$CF ;Set Size Register Mask
|
||||||
|
BNE SETLRS ;and Update Size Register
|
||||||
|
|
||||||
|
;sethsc() - Set Layer 0/1 Horizontal Scroll
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y,X = Map Base
|
||||||
|
;Sets: TEMP1,TEMP2 = Horizontal Scroll
|
||||||
|
;Affects: A,Y,X
|
||||||
|
SETHSC: JSR SAVRXY ;Store Horizontal Scroll in TEMP1,TEMP2
|
||||||
|
LDX #6 ;Set Register Offset
|
||||||
|
|
||||||
|
;setlri() - Write Integer to Get Layer 0/1 Register
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; X = Register Offset
|
||||||
|
;Uses: TEMP1,TEMP2 = Integer Value
|
||||||
|
;Affects: A,Y,X
|
||||||
|
SETLRI: JSR GETLRP ;Get Layer Page in Y
|
||||||
|
JMP SETREI ;and Write Integer to Register
|
||||||
|
|
||||||
|
;setmbs() - Set Layer 0/1 Map Base
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y,X = Map Base
|
||||||
|
;Sets: TEMP1,TEMP2 = Map Base
|
||||||
|
;Affects: A,Y,X
|
||||||
|
SETMBS: JSR SAVRXY ;Store Map Base in TEMP1,TEMP2
|
||||||
|
LDX #2 ;Set Register Offset
|
||||||
|
BNE SETLRI ;Write to Layer Register
|
||||||
|
|
||||||
|
;settbs() - Set Layer 0/1 Map Base
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y,X = Map Base
|
||||||
|
;Sets: TEMP1,TEMP2 = Map Base
|
||||||
|
;Affects: A,Y,X
|
||||||
|
SETTBS: JSR SAVRXY ;Store Map Base in TEMP1,TEMP2
|
||||||
|
LDX #4 ;Set Register Offset
|
||||||
|
BNE SETLRI ;Write to Layer Register
|
||||||
|
|
||||||
|
;setvsc() - Set Layer 0/1 Vertical Scroll
|
||||||
|
;Args: A = Layer (0/1)
|
||||||
|
; Y,X = Map Base
|
||||||
|
;Sets: TEMP1,TEMP2 = Vertical Scroll
|
||||||
|
;Affects: A,Y,X
|
||||||
|
SETVSC: JSR SAVRXY ;Store Vertical Scroll in TEMP1,TEMP2
|
||||||
|
LDX #8 ;Set Register Offset
|
||||||
|
BNE SETLRI ;Write to Layer Register
|
108
x16/include/veralyr.h02
Normal file
108
x16/include/veralyr.h02
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*********************************************
|
||||||
|
* veralyr.h02 - Layer control functions for *
|
||||||
|
* Commander X16 VERA Chip *
|
||||||
|
* Requires: x16.h02 *
|
||||||
|
* stddef.h02 *
|
||||||
|
* veramem.h02 *
|
||||||
|
*********************************************/
|
||||||
|
|
||||||
|
/* Get Layer Enabled *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: $FF = Layer Enabled *
|
||||||
|
* $00 = Disabled */
|
||||||
|
char getenb();
|
||||||
|
|
||||||
|
/* Get Horizontal Scroll Offset *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: int d - Horizontal Scroll */
|
||||||
|
char gethsc();
|
||||||
|
|
||||||
|
/* Get Layer Mode *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: char m - Layer Mode */
|
||||||
|
char getmod();
|
||||||
|
|
||||||
|
/* Get Map Base Address *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: char b - Bank *
|
||||||
|
* int d - Address */
|
||||||
|
char getmba();
|
||||||
|
|
||||||
|
/* Get Map Base Register *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: int d - Map Base */
|
||||||
|
char getmbs();
|
||||||
|
|
||||||
|
//Not Implemented
|
||||||
|
/* Get Map Size Specifier *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: char w - Map Width *
|
||||||
|
* char h - Map Height */
|
||||||
|
char getmsz();
|
||||||
|
|
||||||
|
/* Get Tile Base Address *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: char b - Bank *
|
||||||
|
* int d - Address */
|
||||||
|
char gettba();
|
||||||
|
|
||||||
|
/* Get Tile Base Register *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: int d - Tile Base */
|
||||||
|
char gettbs();
|
||||||
|
|
||||||
|
//Not Implemented
|
||||||
|
/* Get Tile Size Specifier *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: char s - Tile Size */
|
||||||
|
char gettsz();
|
||||||
|
|
||||||
|
/* Get Vertical Scroll Offset *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: int d - Vertical Scroll */
|
||||||
|
char getvsc();
|
||||||
|
|
||||||
|
/* Convert Map Size to Pixels *
|
||||||
|
* Args: char s - Map Size Specifier *
|
||||||
|
* Returns: int p - Size in Pixels */
|
||||||
|
char mapsiz();
|
||||||
|
|
||||||
|
/* Set Layer Enabled *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* char e - Enabled */
|
||||||
|
char setenb();
|
||||||
|
|
||||||
|
/* Set Horizontal Scroll Offset *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* int d - Horizontal Scroll */
|
||||||
|
char sethsc();
|
||||||
|
|
||||||
|
/* Set Layer Mode *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* Returns: char m - Layer Mode */
|
||||||
|
char setmod();
|
||||||
|
|
||||||
|
/* Set Map Base Register *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* int d - Map Base */
|
||||||
|
char setmbs();
|
||||||
|
|
||||||
|
/* Set Map Size Specifier *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* char s - Map Size */
|
||||||
|
char setmsz();
|
||||||
|
|
||||||
|
/* Set Tile Base Register *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* int d - Tile Base */
|
||||||
|
char settbs();
|
||||||
|
|
||||||
|
/* Set Tile Size Specifier *
|
||||||
|
* Args: char l - Layer (0/1) *
|
||||||
|
* char s - Tile Size */
|
||||||
|
char settsz();
|
||||||
|
|
||||||
|
/* Convert Tile Size to Pixels *
|
||||||
|
* Args: char s - Tile Size Specifier *
|
||||||
|
* Returns: int p - Size in Pixels */
|
||||||
|
char tilsiz();
|
@ -2,6 +2,31 @@
|
|||||||
; Requires External Routines RESRXY, SETDST, and SETSRC
|
; Requires External Routines RESRXY, SETDST, and SETSRC
|
||||||
; and External Variables TEMP0 and TEMP1
|
; and External Variables TEMP0 and TEMP1
|
||||||
|
|
||||||
|
;Vera External Registers
|
||||||
|
;$9F20 Address LSB
|
||||||
|
;$9F21 Address MSB
|
||||||
|
;$9F22 Auto-Increment and Address Bank
|
||||||
|
;$9F23 Data Port 0
|
||||||
|
;$9F24 Data Port 1
|
||||||
|
;$9F25 Control Register
|
||||||
|
;$9F26 Interrupt Enable
|
||||||
|
;$9F27 Interrupt Status
|
||||||
|
|
||||||
|
|
||||||
|
;asladr() - Shift Vera Address Left`
|
||||||
|
;Args: X = Number of Bits to Shift
|
||||||
|
;Updates: TEMP0 = Bank
|
||||||
|
; TEMP1 = Address LSB
|
||||||
|
; TEMP3 = Address MSB
|
||||||
|
;Returns: A = Bank
|
||||||
|
; Y,X = Address
|
||||||
|
ASLADR: ASL TEMP1 ;Shift LSB Left
|
||||||
|
ROL TEMP2 ;Rotate Carry Left into MSB
|
||||||
|
ROL TEMP0 ;Rotate Carry Left into LSB
|
||||||
|
DEX ;Decrement Shift Count
|
||||||
|
BNE ASLADR ;and Loop if Not Zero
|
||||||
|
JMP RESREG ;Return Bank, MSB, LSB
|
||||||
|
|
||||||
;getadr() - Get Vera Address
|
;getadr() - Get Vera Address
|
||||||
;Args: A = Bank + Auto-Increment
|
;Args: A = Bank + Auto-Increment
|
||||||
; Y,X = Address
|
; Y,X = Address
|
||||||
@ -10,13 +35,12 @@ GETADR: LDX $9F20 ;Store Address LSB
|
|||||||
LDA $9F22 ;Store Bank & Auto-Increment
|
LDA $9F22 ;Store Bank & Auto-Increment
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
;getreg(&addr) - Read Vera Internal Register
|
;getvrg(&addr) - Read Vera Internal Register
|
||||||
;Args: Y,X = Address
|
;Args: Y,X = Address
|
||||||
;Returns: A = Mode
|
;Returns: A = Mode
|
||||||
; X = Current Data Port
|
; X = Current Data Port
|
||||||
GETREG: LDA #$0F ;Set Bank to Registers
|
GETVRG: LDA #$0F ;Set Bank to Registers
|
||||||
;and Execute GETBYT
|
;and Execute GETBYT
|
||||||
|
|
||||||
;getbyt(&addr);
|
;getbyt(&addr);
|
||||||
;Args: A = Bank
|
;Args: A = Bank
|
||||||
; Y,X = Address
|
; Y,X = Address
|
||||||
@ -47,11 +71,11 @@ GETMEL: LDA $9F23,X ;Read Byte from Data Port
|
|||||||
CPY TEMP0 ;If Limit Not Reached
|
CPY TEMP0 ;If Limit Not Reached
|
||||||
BNE GETMEL ; Loop
|
BNE GETMEL ; Loop
|
||||||
|
|
||||||
;getrei(addr); Read Vera Register Pair
|
;getvri(addr); Read Vera Register Pair
|
||||||
;Args: Y,X = Address
|
;Args: Y,X = Address
|
||||||
;Returns: A,X = Integer LSB
|
;Returns: A,X = Integer LSB
|
||||||
; Y = Integer LSB
|
; Y = Integer LSB
|
||||||
GETREI: LDA #$0F ;Set Bank to Registers
|
GETVRI: LDA #$0F ;Set Bank to Registers
|
||||||
|
|
||||||
;getint(addr); Read Integer from Vera Memory
|
;getint(addr); Read Integer from Vera Memory
|
||||||
;Args: A = Bank
|
;Args: A = Bank
|
||||||
@ -84,7 +108,6 @@ SETADR: STX $9F20 ;Store Address LSB
|
|||||||
;Args: A = Value to Write
|
;Args: A = Value to Write
|
||||||
; Y,X = Address
|
; Y,X = Address
|
||||||
;Sets: TEMP0 = Value to Write
|
;Sets: TEMP0 = Value to Write
|
||||||
;Affects: Y
|
|
||||||
;Returns: A = Value Written
|
;Returns: A = Value Written
|
||||||
; X = Current Data Port
|
; X = Current Data Port
|
||||||
SETREG: STA TEMP0 ;Save Value to Write
|
SETREG: STA TEMP0 ;Save Value to Write
|
||||||
@ -94,7 +117,6 @@ SETREH: LDA #$0F ;Set Bank, Auto-Increment
|
|||||||
;Args: A = Bank
|
;Args: A = Bank
|
||||||
; Y,X = Address
|
; Y,X = Address
|
||||||
;Uses: TEMP0 = Value to Write
|
;Uses: TEMP0 = Value to Write
|
||||||
;Affects: Y
|
|
||||||
;Returns: A = Value Written
|
;Returns: A = Value Written
|
||||||
; X = Current Data Port
|
; X = Current Data Port
|
||||||
SETBYT: JSR SETADR ;Set Vera Address
|
SETBYT: JSR SETADR ;Set Vera Address
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
/*********************************************
|
/*********************************************
|
||||||
* veramem.h02 - Memory Access Functions for *
|
* veramem.h02 - Memory Access Functions for *
|
||||||
* Commander X16 VERA Chip *
|
* Commander X16 VERA Chip *
|
||||||
|
* *
|
||||||
|
* Requires: x16.h02 *
|
||||||
|
* stddef.h02 *
|
||||||
*********************************************/
|
*********************************************/
|
||||||
|
|
||||||
/* Get Vera Memory Address *
|
/* Get Vera Memory Address *
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*****************************************************
|
/************************************
|
||||||
* TESTVERA *
|
* TESTVERA - Test All Vera Modules *
|
||||||
*****************************************************/
|
************************************/
|
||||||
|
|
||||||
//Specify System Header using -H option
|
//Specify System Header using -H option
|
||||||
#include <stddef.h02>
|
#include <stddef.h02>
|
||||||
@ -10,9 +10,10 @@
|
|||||||
#include <stdiox.h02>
|
#include <stdiox.h02>
|
||||||
#include <memory.h02>
|
#include <memory.h02>
|
||||||
#include <nybble.h02>
|
#include <nybble.h02>
|
||||||
#include "include/veramem.h02"
|
#include "include/veramem.h02" //Vera Memory Access
|
||||||
#include "include/veradsp.h02"
|
#include "include/veradsp.h02" //Vera Display Controller
|
||||||
#include "include/veraclr.h02"
|
#include "include/veraclr.h02" //Vera Color Palette
|
||||||
|
#include "include/veralyr.h02" //Vera Layer Control
|
||||||
#include "include/vera.h02"
|
#include "include/vera.h02"
|
||||||
|
|
||||||
const char abcdef = {1,2,3,4,5,6};
|
const char abcdef = {1,2,3,4,5,6};
|
||||||
@ -33,9 +34,16 @@ int irqlin; //IRQ Line#
|
|||||||
|
|
||||||
/* Layer 0/1 */
|
/* Layer 0/1 */
|
||||||
|
|
||||||
|
const char msizel = {32,64,128,0};
|
||||||
|
const char msizeh = { 0, 0, 0,1};
|
||||||
|
const char tsizel = {8,16};
|
||||||
|
|
||||||
char layer; //Layer Number
|
char layer; //Layer Number
|
||||||
char layer0[9]; //Layer 0 Register Contents
|
char layer0[9]; //Layer 0 Register Contents
|
||||||
char layer1[9]; //Layer 1 Register Contents
|
char layer1[9]; //Layer 1 Register Contents
|
||||||
|
char height,width; //Map/Tile Height, Width Specifiers
|
||||||
|
char tsize; //Tile Size in Pixels
|
||||||
|
int msize; //Map Size in Pixeks
|
||||||
int mbase0,mbase1; //Map Base, Layer 0 and 1
|
int mbase0,mbase1; //Map Base, Layer 0 and 1
|
||||||
int tbase0,tbase1; //Tile Base, Layer 0 and 1
|
int tbase0,tbase1; //Tile Base, Layer 0 and 1
|
||||||
int mbaddr,tbaddr; //Map and Tile Base Address
|
int mbaddr,tbaddr; //Map and Tile Base Address
|
||||||
@ -88,7 +96,7 @@ void prtvid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void xerror() {
|
void xerror() {
|
||||||
putln("ERROR ENCOUNTERED");
|
putln(" ERROR ENCOUNTERED");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,13 +133,11 @@ main:
|
|||||||
passed();
|
passed();
|
||||||
|
|
||||||
puts("TESTING GETSCL() AND SETSCL()");
|
puts("TESTING GETSCL() AND SETSCL()");
|
||||||
i=1;
|
i=1;
|
||||||
do {
|
do {
|
||||||
j=1;
|
j=1;
|
||||||
do {
|
do {
|
||||||
setscl(i,j);
|
setscl(i,j); hscale,vscale = getscl();
|
||||||
hscale,vscale = getscl();
|
|
||||||
//prtscl;
|
|
||||||
if (hscale<>i or vscale<>j) xerror("ERROR IN GETSCL()/SETSCL()");
|
if (hscale<>i or vscale<>j) xerror("ERROR IN GETSCL()/SETSCL()");
|
||||||
j<<;
|
j<<;
|
||||||
} while (j);
|
} while (j);
|
||||||
@ -180,6 +186,8 @@ main:
|
|||||||
}
|
}
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
puts("TESTING RGBCLR() AND CLRRGB()");
|
puts("TESTING RGBCLR() AND CLRRGB()");
|
||||||
for (red=0;red<16;red++) {
|
for (red=0;red<16;red++) {
|
||||||
for (green=0;green<16;green++) {
|
for (green=0;green<16;green++) {
|
||||||
@ -222,11 +230,57 @@ main:
|
|||||||
}
|
}
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
//putln("SAVING LAYER REGISTERS");
|
//putln("SAVING LAYER REGISTERS");
|
||||||
setadr($1F,&$2000); getmem(@layer0,&layer0);
|
setadr($1F,&$2000); getmem(@layer0,&layer0);
|
||||||
setadr($1F,&$3000); getmem(@layer1,&layer1);
|
setadr($1F,&$3000); getmem(@layer1,&layer1);
|
||||||
|
|
||||||
printf(layer, "TESTING GETMBS() AND SETMBS()");
|
printf("TESTING GETENB() AND SETENB()");
|
||||||
|
setenb(0,$00); if (getenb(0)<>$00) xerror();
|
||||||
|
setenb(0,$FF); if (getenb(0)<>$FF) xerror();
|
||||||
|
setenb(1,$00); if (getenb(1)<>$00) xerror();
|
||||||
|
setenb(1,$FF); if (getenb(1)<>$FF) xerror();
|
||||||
|
passed();
|
||||||
|
|
||||||
|
printf("TESTING GETMOD() AND SETMOD()");
|
||||||
|
for (i=0;i<2;i++) {for (j=0;j<8;j++) {
|
||||||
|
setmod(i,j); if (getmod(i)<>j) goto reslyr; //xerror();
|
||||||
|
} }
|
||||||
|
passed();
|
||||||
|
|
||||||
|
printf("TESTING GETMSZ() AND SETMSZ()");
|
||||||
|
for (i=0;i<2;i++) {for (j=0;j<4;j++) {for (k=0;k<4;k++) {
|
||||||
|
//printf(j,"%nJ=%h, "); printf(k,"K=%h");
|
||||||
|
setmsz(i,j,k); width, height = getmsz(i);
|
||||||
|
//printf(width," WIDTH=%h, "); printf(height,"HEIGHT=%h");
|
||||||
|
if (width<>j or height<>k) xerror();
|
||||||
|
}}}
|
||||||
|
passed();
|
||||||
|
|
||||||
|
printf("TESTING GETTSZ() AND SETTSZ()");
|
||||||
|
for (i=0;i<2;i++) {for (j=0;j<2;j++) {for (k=0;k<2;k++) {
|
||||||
|
//printf(j,"%nJ=%h, "); printf(k,"K=%h");
|
||||||
|
settsz(i,j,k); width, height = gettsz(i);
|
||||||
|
//printf(width," WIDTH=%h, "); printf(height,"HEIGHT=%h");
|
||||||
|
if (width<>j or height<>k) xerror();
|
||||||
|
}}}
|
||||||
|
passed();
|
||||||
|
|
||||||
|
printf("TESTING MAPSIZ() AND TILSIZ()");
|
||||||
|
for (i=0; i<@msizel; i++) {
|
||||||
|
msize = mapsiz(i);
|
||||||
|
//printf(i,"%nMAP SIZE %h = "); setdst(msize); printf("$%w PIXELS");
|
||||||
|
if (<msize<>msizel[i] or >msize<>msizeh[i]) xerror();
|
||||||
|
}
|
||||||
|
for (i=0; i<@tsizel; i++) {
|
||||||
|
tsize = tilsiz(i);
|
||||||
|
//printf(i,"%nTILE SIZE %h = "); printf(tsize, "$%h PIXELS");
|
||||||
|
if (tsize<>tsizel[i]) xerror();
|
||||||
|
}
|
||||||
|
passed();
|
||||||
|
|
||||||
|
printf("TESTING GETMBS() AND SETMBS()");
|
||||||
setmbs(0,&$1234); mbase0 = getmbs(0);
|
setmbs(0,&$1234); mbase0 = getmbs(0);
|
||||||
setmbs(1,&$5678); mbase1 = getmbs(1);
|
setmbs(1,&$5678); mbase1 = getmbs(1);
|
||||||
//setdst(mbase0); printf("%nMBASE0=$%w, "); setdst(mbase1); printf("MBASE1=$%w%n");
|
//setdst(mbase0); printf("%nMBASE0=$%w, "); setdst(mbase1); printf("MBASE1=$%w%n");
|
||||||
@ -234,7 +288,7 @@ main:
|
|||||||
if (>mbase1<>$56 or <mbase1<>$78) xerror();
|
if (>mbase1<>$56 or <mbase1<>$78) xerror();
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
printf(layer, "TESTING GETTBS() AND SETTBS()");
|
printf("TESTING GETTBS() AND SETTBS()");
|
||||||
settbs(0,&$90AB); tbase0 = gettbs(0);
|
settbs(0,&$90AB); tbase0 = gettbs(0);
|
||||||
settbs(1,&$CDEF); tbase1 = gettbs(1);
|
settbs(1,&$CDEF); tbase1 = gettbs(1);
|
||||||
//setdst(tbase0); printf("%nTBASE0=$%w, "); setdst(tbase1); printf("TBASE1=$%w%n");
|
//setdst(tbase0); printf("%nTBASE0=$%w, "); setdst(tbase1); printf("TBASE1=$%w%n");
|
||||||
@ -242,14 +296,14 @@ main:
|
|||||||
if (>tbase1<>$CD or <tbase1<>$EF) xerror();
|
if (>tbase1<>$CD or <tbase1<>$EF) xerror();
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
printf(layer, "TESTING GETMBA() AND GETTBA()");
|
printf("TESTING GETMBA() AND GETTBA()");
|
||||||
i,j,k = getmba(0); if (i<>$00 or j<>$48 or k<>$D0) xerror();
|
i,j,k = getmba(0); if (i<>$00 or j<>$48 or k<>$D0) xerror();
|
||||||
i,j,k = getmba(1); if (i<>$01 or j<>$59 or k<>$E0) xerror();
|
i,j,k = getmba(1); if (i<>$01 or j<>$59 or k<>$E0) xerror();
|
||||||
i,j,k = gettba(0); if (i<>$02 or j<>$42 or k<>$AC) xerror();
|
i,j,k = gettba(0); if (i<>$02 or j<>$42 or k<>$AC) xerror();
|
||||||
i,j,k = gettba(1); if (i<>$03 or j<>$37 or k<>$BC) xerror();
|
i,j,k = gettba(1); if (i<>$03 or j<>$37 or k<>$BC) xerror();
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
printf(layer, "TESTING GETHSC() AND SETHSC()");
|
printf("TESTING GETHSC() AND SETHSC()");
|
||||||
sethsc(0,&$1357); hscrl0 = gethsc(0);
|
sethsc(0,&$1357); hscrl0 = gethsc(0);
|
||||||
sethsc(1,&$2468); hscrl1 = gethsc(1);
|
sethsc(1,&$2468); hscrl1 = gethsc(1);
|
||||||
//setdst(hscrl0); printf("%nHSCRL0=$%w, "); setdst(hscrl1); printf("HSCRL1=$%w%n");
|
//setdst(hscrl0); printf("%nHSCRL0=$%w, "); setdst(hscrl1); printf("HSCRL1=$%w%n");
|
||||||
@ -257,7 +311,7 @@ main:
|
|||||||
if (>hscrl1<>$24 or <hscrl1<>$68) xerror();
|
if (>hscrl1<>$24 or <hscrl1<>$68) xerror();
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
printf(layer, "TESTING GETVSC() AND SETVSC()");
|
printf("TESTING GETVSC() AND SETVSC()");
|
||||||
setvsc(0,&$9BDF); vscrl0 = getvsc(0);
|
setvsc(0,&$9BDF); vscrl0 = getvsc(0);
|
||||||
setvsc(1,&$0ACE); vscrl1 = getvsc(1);
|
setvsc(1,&$0ACE); vscrl1 = getvsc(1);
|
||||||
//setdst(vscrl0); printf("%nVSCRL0=$%w, "); setdst(hscrl1); printf("VSCRL1=$%w%n");
|
//setdst(vscrl0); printf("%nVSCRL0=$%w, "); setdst(hscrl1); printf("VSCRL1=$%w%n");
|
||||||
@ -265,7 +319,15 @@ main:
|
|||||||
if (>vscrl1<>$0A or <vscrl1<>$CE) xerror();
|
if (>vscrl1<>$0A or <vscrl1<>$CE) xerror();
|
||||||
passed();
|
passed();
|
||||||
|
|
||||||
//putln("RESTORING LAYER REGISTERS");
|
printf("TESTING GETBPO() AND SETBPO()");
|
||||||
|
i = 0; do {
|
||||||
|
setbpo(0,i); if (getbpo(0)<>i) xerror();
|
||||||
|
setbpo(1,i); if (getbpo(1)<>i) xerror();
|
||||||
|
i = i + 16;
|
||||||
|
} while (i);
|
||||||
|
passed();
|
||||||
|
|
||||||
|
reslyr:
|
||||||
setadr($1F, &$2000); setmem(@layer0, &layer0);
|
setadr($1F, &$2000); setmem(@layer0, &layer0);
|
||||||
setadr($1F, &$3000); setmem(@layer1, &layer1);
|
setadr($1F, &$3000); setmem(@layer1, &layer1);
|
||||||
|
|
||||||
|
138
x16/veraregs.c02
Normal file
138
x16/veraregs.c02
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
/*************************************************
|
||||||
|
* VERAREGS - Display Contents of Vera Registers *
|
||||||
|
*************************************************/
|
||||||
|
|
||||||
|
//Specify System Header using -H option
|
||||||
|
#include <stddef.h02>
|
||||||
|
#include <stdlib.h02>
|
||||||
|
#include <intlib.h02>
|
||||||
|
#include <stdio.h02>
|
||||||
|
#include <stdiox.h02>
|
||||||
|
#include <memory.h02>
|
||||||
|
#include <nybble.h02>
|
||||||
|
#include <screen.h02>
|
||||||
|
#include "include/veramem.h02" //Vera Memory Access
|
||||||
|
#include "include/veradsp.h02" //Vera Display Controller
|
||||||
|
#include "include/veraclr.h02" //Vera Color Palette
|
||||||
|
#include "include/veralyr.h02" //Vera Layer Control
|
||||||
|
#include "include/vera.h02"
|
||||||
|
|
||||||
|
/* Globals */
|
||||||
|
char i,j,k; //Loop Indexes
|
||||||
|
char aa,yy,xx; //Function Paramaters
|
||||||
|
int yx; //Function Paramater
|
||||||
|
|
||||||
|
/* Display Composer */
|
||||||
|
char vmode,mono,field; //Video Output Mode, Monochrome Flag, Current Field
|
||||||
|
char hscale,vscale; //Video Scaling
|
||||||
|
char bcpidx; //Border Color Palette Index
|
||||||
|
int bcolor; //Border Color Value
|
||||||
|
int hstart,hstop; //Horizontal Start and Stop
|
||||||
|
int vstart,vstop; //Vertical Start and Stop
|
||||||
|
|
||||||
|
/* Layer 0/1 */
|
||||||
|
char layer; //Layer Number
|
||||||
|
char lmode; //Layer Mode
|
||||||
|
char height,width; //Map/Tile Height and Width
|
||||||
|
|
||||||
|
|
||||||
|
//Print Vera Address
|
||||||
|
void prtadr(aa,yx) {
|
||||||
|
puts("ADDRESS: $"); putnyb(aa); putwrd(yx);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Print Three Values Enclosed in Parentheses
|
||||||
|
void prtprn(aa,yy,xx) {
|
||||||
|
printf(aa,"($%h"); printf(yy,",$%h"); printf(xx,",$%h)");
|
||||||
|
}
|
||||||
|
|
||||||
|
main:
|
||||||
|
|
||||||
|
clrscr(); //Clear Screen
|
||||||
|
|
||||||
|
putln("DISPLAY COMPOSER");
|
||||||
|
|
||||||
|
puts(" VIDEO MODE: ");
|
||||||
|
vmode,mono,field = getvid();
|
||||||
|
select (vmode) {
|
||||||
|
case 0: puts("DISABLED");
|
||||||
|
case 1: puts("VGA");
|
||||||
|
case 2: puts("NTSC");
|
||||||
|
case 3: puts("RGB");
|
||||||
|
default: puts("UNDEFINED");
|
||||||
|
}
|
||||||
|
if (mono) puts(" MONOCHROME"); else puts(" COLOR");
|
||||||
|
if (field) puts(", ODD"); else puts(", EVEN"); putln(" FIELD");
|
||||||
|
|
||||||
|
bcpidx = getbdr(); printf(bcpidx, " BORDER PALETTE INDEX: $%h");
|
||||||
|
bcolor = getclr(bcpidx); puts(setdst(bcolor)); printf(", COLOR=$%w ");
|
||||||
|
prtprn(clrrgb(bcolor)); newlin();
|
||||||
|
|
||||||
|
hscale,vscale = getscl(); hstart = gethsr(); hstop = gethsp(); vstart = getvsr(); vstop = getvsp();
|
||||||
|
printf(hscale, " HORIZONTAL SCALE: $%h, "); setdst(hstart); printf("START: $%w, "); setdst(hstop); printf("STOP: $%q%n");
|
||||||
|
printf(vscale, " VERTICAL SCALE: $%h, "); setdst(vstart); printf("START: $%q, "); setdst(vstop); printf("STOP: $%q%n");
|
||||||
|
|
||||||
|
setdst(getiql()); printf(" IRQ LINE: $%w%n");
|
||||||
|
newlin();
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
putln("PALETTE COLORS");
|
||||||
|
|
||||||
|
putrps(5); i=0 ;do {printf(i," %h "); i=i+16; } while(i) ; newlin();
|
||||||
|
for (i=0;i<16;i++) {
|
||||||
|
printf(i," %h ");
|
||||||
|
j=0; do {
|
||||||
|
k = i + j; setdst(getclr(k)); printf(k,"%q ");
|
||||||
|
j = j + 16;
|
||||||
|
} while (j);
|
||||||
|
newlin();
|
||||||
|
}
|
||||||
|
newlin();
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
for (layer=0; layer<2; layer++) {
|
||||||
|
|
||||||
|
printf(layer, "LAYER %h%n");
|
||||||
|
|
||||||
|
puts(" MODE: "); lmode = getmod(layer);
|
||||||
|
select(getmod(layer)) {
|
||||||
|
case 0: puts("16 COLOR TEXT");
|
||||||
|
case 1: puts("256 COLOR TEXT");
|
||||||
|
case 2: puts("TILE 2BPP");
|
||||||
|
case 3: puts("TILE 4BPP");
|
||||||
|
case 4: puts("TILE 8BPP");
|
||||||
|
case 5: puts("BITMAP 2BPP");
|
||||||
|
case 6: puts("BITMAP 4BPP");
|
||||||
|
case 7: puts("BITMAP 8BPP");
|
||||||
|
default: puts("UNDEFINED");
|
||||||
|
}
|
||||||
|
if (getenb(layer)) putln(", ENABLED"); else putln(", DISABLED");
|
||||||
|
|
||||||
|
width, height = getmsz(layer);
|
||||||
|
setdst(mapsiz(width)); printf(width," MAP WIDTH: $%h ($%w PIXELS)");
|
||||||
|
setdst(mapsiz(height)); printf(height,", HEIGHT: $%h ($%w PIXELS)%n");
|
||||||
|
|
||||||
|
width, height = gettsz(layer);
|
||||||
|
printf(width," TILE WIDTH: $%h"); printf(tilsiz(width)," ($%w PIXELS)");
|
||||||
|
printf(height,", HEIGHT: $%h "); printf(tilsiz(height)," ($%h PIXELS)%n");
|
||||||
|
|
||||||
|
setdst(getmbs(layer)); printf(" MAP BASE: $%w, ");
|
||||||
|
prtadr(getmba(layer)); newlin();
|
||||||
|
|
||||||
|
setdst(gettbs(layer)); printf(" TILE BASE: $%w, ");
|
||||||
|
prtadr(gettba(layer)); newlin();
|
||||||
|
|
||||||
|
setdst(gethsc(layer)); printf(" HORIZONTAL SCROLL: $%q");
|
||||||
|
setdst(getvsc(layer)); printf(", VERTICAL SCROLL: $%q%n");
|
||||||
|
|
||||||
|
printf(getbpo(layer)); printf(" BITMAP PALETTE OFFSET: $%h%n");
|
||||||
|
|
||||||
|
newlin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
goto exit;
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user