mirror of
https://github.com/nathanriggs/AppleIIAsm-Collection.git
synced 2025-01-09 13:32:35 +00:00
9b12b6fd9b
- getting ready for major changes for 0.6.0. - be sure to download the 0.5.0 release to ensure proper functionality, as these rountines will not work together in the SRC or BIN folder during the transition - Beginning to significantly alter documentation
132 lines
5.0 KiB
NASM
132 lines
5.0 KiB
NASM
*``````````````````````````````*
|
|
* HOOKS.LORES *
|
|
* *
|
|
* THIS FILE INCLUDES HOODS AND *
|
|
* A FEW SUBROUTINES AND TABLES *
|
|
* USED BY THE REST OF THE LOW *
|
|
* RESOLUTION SUBROUTINES. *
|
|
* *
|
|
* AUTHOR: NATHAN RIGGS *
|
|
* CONTACT: NATHAN.RIGGS@ *
|
|
* OUTLOOK.COM *
|
|
* *
|
|
* DATE: 01-OCT-2019 *
|
|
* ASSEMBLER: MERLIN 8 PRO *
|
|
* LICENSE: APACHE 2.0 *
|
|
* OS: DOS 3.3 *
|
|
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,*
|
|
*
|
|
TEXTOFF EQU $C050 ; TURN ON GRAPHICS MODE
|
|
TEXTON EQU $C051 ; TURN ON TEXT MODE
|
|
MIXEDOFF EQU $C052 ; SET FULLSCREEN MODE FOR GRAPHICS
|
|
MIXEDON EQU $C053 ; SET MIXED MODE FOR GRAPHICS
|
|
LORES EQU $C056 ; SOFT SWITCH FOR USING LORES GRAPHICS
|
|
HIRES EQU $C057 ; SOFT SWITCH TO SPECIFY HIRES GRAPHICS
|
|
VPG1 EQU $C054 ; SET THE VIEWING PAGE TO PAGE 1
|
|
VPG2 EQU $C055 ; SET THE VIEWING PAGE TO PAGE 2
|
|
LRGBCALC EQU $F847 ; FOR CALCULATING LORES COORDINATES
|
|
GBASLO EQU $26 ; LOW BYTE OF A PIXEL ADDRESS
|
|
GBASHI EQU $27 ; HIGHT BYTE OF PIXEL ADDRESS
|
|
*
|
|
]BLACK EQU $00 ; LORES COLOR BLACK
|
|
]MAGENTA EQU $01 ; LORES COLOR MAGENTA
|
|
]DBLUE EQU $02 ; LORES DARK BLUE
|
|
]PURPLE EQU $03 ; LORES COLOR PURPLE
|
|
]DGREEN EQU $04 ; LORES COLOR DARK GREEN
|
|
]GREY1 EQU $05 ; LORES COLOR FIRST GREY SHADE
|
|
]MBLUE EQU $06 ; LORES COLOR MEDIUM BLUE
|
|
]LBLUE EQU $07 ; LORES COLOR LIGHT BLUE
|
|
]BROWN EQU $08 ; LORES COLOR BROWN
|
|
]ORANGE EQU $09 ; LORES COLOR ORANGE
|
|
]GREY2 EQU $0A ; LORES COLORE GREY SHADE 2
|
|
]PINK EQU $0B ; LORES COLOR PINK
|
|
MGREEN EQU $0C ; LORES COLOR MEDIUM GREEN
|
|
]YELLOW EQU $0D ; LORES COLOR YELLOW
|
|
]AQUA EQU $0E ; LORES COLOR AQUAMARINE
|
|
]WHITE EQU $0F ; LORES COLOR WHITE
|
|
*
|
|
*
|
|
** THE LOCPLOT SUBROUTINE IS IN THE HOOKS FILE
|
|
** BECAUSE IT IS USED, IN SOME CAPACITY, BY THE
|
|
** REST OF THE LORES LIBRARY.
|
|
*
|
|
JMP ]EOF
|
|
*
|
|
]LOCCOL DS 1 ; LOCAL PLOT COLOR
|
|
]MASK DS 2 ; MASK FOR ISOLATING NIBBLE
|
|
]COLMASK DS 2 ; COLOR MASK
|
|
]X DS 1 ; X COORDINATE FOR PLOT
|
|
]Y DS 1 ; Y COORDINATE FOR PLOT
|
|
]PAGEOFF DS 1 ; PAGE OFFSET
|
|
*
|
|
LOCPLOT
|
|
*
|
|
STY ]Y ; Y POSITION PASSED IN .Y
|
|
STX ]X ; X POSITION PASSED IN .X
|
|
STA ]LOCCOL ; COLOR PASSED IN .A
|
|
LDA ]LOCCOL ; TAKE THE COLOR SENT
|
|
ASL ; AND MOVE IT LEFT 4 BITS
|
|
ASL ; TO THE HIGH BYTE
|
|
ASL
|
|
ASL
|
|
CLC ; CLEAR CARRY
|
|
ADC ]LOCCOL ; NOW ADD THE LOW BYTE BACK, MEANING
|
|
STA ]LOCCOL ; THAT THE COLOR WILL BE REPEATING NIBBLES
|
|
LDA LWP ; LOAD THE WORKING PAGE FLAG
|
|
CMP #2 ; IF THE WORKING PAGE IS NOT PAGE 2,
|
|
BNE :PG1 ; THEN ASSUME IT'S PAGE 1.
|
|
LDA #4 ; ELSE, SET OFFSET FOR PAGE 2
|
|
STA ]PAGEOFF ; STORE IN THE PAGE OFFEST
|
|
JMP :CNT ; SKIP TO CONTINUE ROUTINE
|
|
:PG1
|
|
LDA #0 ; OTHERWISE, IT'S PAGE ONE
|
|
STA ]PAGEOFF ; SO THERE IS NO PAGE OFFSET
|
|
:CNT
|
|
LDA #0
|
|
LDY #0
|
|
LDX #0
|
|
LDA ]Y ; GET Y COORDINATE
|
|
LSR ; SHIFT BOTTOM BIT TO CARRY
|
|
; BUT WHY?
|
|
BCC :EVEN ; IF CARRY = 0, THEN ROW IS EVEN
|
|
LDX #$F0 ; OTHERWISE, IT IS ODD; SO MASK
|
|
; THE LEFT NIBBLE
|
|
BCS :LPLOT ; IF CARRY IS SET, BRANCH TO PLOTTING
|
|
:EVEN
|
|
LDX #$0F ; EVEN, SO MASK LOW BYTE
|
|
:LPLOT
|
|
STX ]MASK ; STORE THE EVEN OR ODD MASK
|
|
ASL ; SHIFT CARRY BACK INTO BYTE
|
|
TAY ; HOLD VALUE INTO .Y
|
|
LDA LROFF,Y ; GET LORES MEMORY ADDRESS
|
|
CLC ; CLEAR THE CARRY
|
|
ADC ]X ; ADD THE X COORDINATE
|
|
STA GBASLO ; STORE LOW BYTE FOR GBASCALC
|
|
INY ; INCREASE Y OFFSET
|
|
LDA LROFF,Y ; GET LORESS MEMORY ADDRESS
|
|
ADC ]PAGEOFF ; ADJUST FOR PAGE AND CARRY HIGH
|
|
STA GBASHI ; STORE HIGH BYTE FOR GBASCALC
|
|
LDY #0
|
|
LDA ]MASK ; RELOAD THE MASK
|
|
EOR #$FF ; EXCLUSIVE OR THE MASK
|
|
AND (GBASLO),Y ; AND THE LOW FOR GBAS
|
|
STA ]COLMASK ; STORE THE COLOR MASK
|
|
LDA ]LOCCOL ; LOAD THE COLOR
|
|
AND ]MASK ; AND THE MASK
|
|
ORA ]COLMASK ; OR WITH THE COLOR MASK
|
|
STA (GBASLO),Y ; STORE INTO GBAS LOW BYTE
|
|
RTS
|
|
*
|
|
*
|
|
LWP DS 1,1 ; BYTE FOR DETERMINING WORKING PAGE
|
|
*
|
|
** THE FOLLOWING TABLE HELPS WITH FASTER PLOTTING TO THE
|
|
** LOW RESOLUTION SCREEN.
|
|
*
|
|
LROFF DW $400,$480,$500,$580,$600,$680,$700,$780
|
|
DW $428,$4A8,$528,$5A8,$628,$6A8,$728,$7A8
|
|
DW $450,$4D0,$550,$5D0,$650,$6D0,$750,$7D0
|
|
*
|
|
*
|
|
]EOF
|