mirror of
https://github.com/zellyn/goapple2.git
synced 2024-12-21 13:29:41 +00:00
154 lines
6.3 KiB
Plaintext
154 lines
6.3 KiB
Plaintext
|
1010 *--------------------------------
|
||
|
1020 * "HGR" AND "HGR2" STATEMENTS
|
||
|
1030 *--------------------------------
|
||
|
1040 HGR2 BIT SW.HISCR SELECT PAGE 2 ($4000-5FFF)
|
||
|
1050 BIT SW.MIXCLR DEFAULT TO FULL SCREEN
|
||
|
1060 LDA /$4000 SET STARTING PAGE FOR HIRES
|
||
|
1070 BNE SETHPG ...ALWAYS
|
||
|
1080 HGR LDA /$2000 SET STARTING PAGE FOR HIRES
|
||
|
1090 BIT SW.LOWSCR SELECT PAGE 1 ($2000-3FFF)
|
||
|
1100 BIT SW.MIXSET DEFAULT TO MIXED SCREEN
|
||
|
1110 SETHPG STA HGR.PAGE BASE PAGE OF HIRES BUFFER
|
||
|
1120 LDA SW.HIRES TURN ON HIRES
|
||
|
1130 LDA SW.TXTCLR TURN ON GRAPHICS
|
||
|
1140 *--------------------------------
|
||
|
1150 * CLEAR SCREEN
|
||
|
1160 *--------------------------------
|
||
|
1170 HCLR LDA #0 SET FOR BLACK BACKGROUND
|
||
|
1180 STA HGR.BITS
|
||
|
1190 *--------------------------------
|
||
|
1200 * FILL SCREEN WITH (HGR.BITS)
|
||
|
1210 *--------------------------------
|
||
|
1220 BKGND LDA HGR.PAGE PUT BUFFER ADDRESS IN HGR.SHAPE
|
||
|
1230 STA HGR.SHAPE+1
|
||
|
1240 LDY #0
|
||
|
1250 STY HGR.SHAPE
|
||
|
1260 .1 LDA HGR.BITS COLOR BYTE
|
||
|
1270 STA (HGR.SHAPE),Y CLEAR HIRES TO HGR.BITS
|
||
|
1280 JSR COLOR.SHIFT CORRECT FOR COLOR SHIFT
|
||
|
1290 INY (SLOWS CLEAR BY FACTOR OF 2)
|
||
|
1300 BNE .1
|
||
|
1310 INC HGR.SHAPE+1
|
||
|
1320 LDA HGR.SHAPE+1
|
||
|
1330 AND #$1F DONE? ($40 OR$60)
|
||
|
1340 BNE .1 NO
|
||
|
1350 RTS YES, RETURN
|
||
|
1360 *--------------------------------
|
||
|
1370 * SET THE HIRES CURSOR POSITION
|
||
|
1380 *
|
||
|
1390 * (Y,X) = HORIZONTAL COORDINATE (0-279)
|
||
|
1400 * (A) = VERTICAL COORDINATE (0-191)
|
||
|
1410 *--------------------------------
|
||
|
1420 HPOSN STA HGR.Y SAVE Y- AND X-POSITIONS
|
||
|
1430 STX HGR.X
|
||
|
1440 STY HGR.X+1
|
||
|
1450 PHA Y-POS ALSO ON STACK
|
||
|
1460 AND #$C0 CALCULATE BASE ADDRESS FOR Y-POS
|
||
|
1470 STA MON.GBASL FOR Y=ABCDEFGH
|
||
|
1480 LSR GBASL=ABAB0000
|
||
|
1490 LSR
|
||
|
1500 ORA MON.GBASL
|
||
|
1510 STA MON.GBASL
|
||
|
1520 PLA (A) (GBASH) (GBASL)
|
||
|
1530 STA MON.GBASH ?-ABCDEFGH ABCDEFGH ABAB0000
|
||
|
1540 ASL A-BCDEFGH0 ABCDEFGH ABAB0000
|
||
|
1550 ASL B-CDEFGH00 ABCDEFGH ABAB0000
|
||
|
1560 ASL C-DEFGH000 ABCDEFGH ABAB0000
|
||
|
1570 ROL MON.GBASH A-DEFGH000 BCDEFGHC ABAB0000
|
||
|
1580 ASL D-EFGH0000 BCDEFGHC ABAB0000
|
||
|
1590 ROL MON.GBASH B-EFGH0000 CDEFGHCD ABAB0000
|
||
|
1600 ASL E-FGH00000 CDEFGHCD ABAB0000
|
||
|
1610 ROR MON.GBASL 0-FGH00000 CDEFGHCD EABAB000
|
||
|
1620 LDA MON.GBASH 0-CDEFGHCD CDEFGHCD EABAB000
|
||
|
1630 AND #$1F 0-000FGHCD CDEFGHCD EABAB000
|
||
|
1640 ORA HGR.PAGE 0-PPPFGHCD CDEFGHCD EABAB000
|
||
|
1650 STA MON.GBASH 0-PPPFGHCD PPPFGHCD EABAB000
|
||
|
1660 TXA DIVIDE X-POS BY 7 FOR INDEX FROM BASE
|
||
|
1670 CPY #0 IS X-POS < 256?
|
||
|
1680 BEQ .2 YES
|
||
|
1690 LDY #35 NO: 256/7 = 36 REM 4
|
||
|
1700 * CARRY=1, SO ADC #4 IS TOO LARGE;
|
||
|
1710 * HOWEVER, ADC #4 CLEARS CARRY
|
||
|
1720 * WHICH MAKES SBC #7 ONLY -6
|
||
|
1730 * BALANCING IT OUT.
|
||
|
1740 ADC #4 FOLLOWING INY MAKES Y=36
|
||
|
1750 .1 INY
|
||
|
1760 .2 SBC #7
|
||
|
1770 BCS .1
|
||
|
1780 STY HGR.HORIZ HORIZONTAL INDEX
|
||
|
1790 TAX USE REMAINDER-7 TO LOOK UP THE
|
||
|
1800 LDA MSKTBL-$100+7,X BIT MASK
|
||
|
1810 STA MON.HMASK
|
||
|
1820 TYA QUOTIENT GIVES BYTE INDEX
|
||
|
1830 LSR ODD OR EVEN COLUMN?
|
||
|
1840 LDA HGR.COLOR IF ON ODD BYTE (CARRY SET)
|
||
|
1850 STA HGR.BITS THEN ROTATE BITS
|
||
|
1860 BCS COLOR.SHIFT ODD COLUMN
|
||
|
1870 RTS EVEN COLUMN
|
||
|
1880 *--------------------------------
|
||
|
1890 * PLOT A DOT
|
||
|
1900 *
|
||
|
1910 * (Y,X) = HORIZONTAL POSITION
|
||
|
1920 * (A) = VERTICAL POSITION
|
||
|
1930 *--------------------------------
|
||
|
1940 HPLOT0 JSR HPOSN
|
||
|
1950 LDA HGR.BITS CALCULATE BIT POSN IN GBAS,
|
||
|
1960 EOR (MON.GBASL),Y HGR.HORIZ, AND HMASK FROM
|
||
|
1970 AND MON.HMASK Y-COOR IN A-REG,
|
||
|
1980 EOR (MON.GBASL),Y X-COOR IN X,Y REGS.
|
||
|
1990 STA (MON.GBASL),Y FOR ANY 1-BITS, SUBSTITUTE
|
||
|
2000 RTS CORRESPONDING BIT OF HGR.BITS
|
||
|
2010 *--------------------------------
|
||
|
2020 * MOVE LEFT OR RIGHT ONE PIXEL
|
||
|
2030 *
|
||
|
2040 * IF STATUS IS +, MOVE RIGHT; IF -, MOVE LEFT
|
||
|
2050 * IF ALREADY AT LEFT OR RIGHT EDGE, WRAP AROUND
|
||
|
2060 *
|
||
|
2070 * REMEMBER BITS IN HI-RES BYTE ARE BACKWARDS ORDER:
|
||
|
2080 * BYTE N BYTE N+1
|
||
|
2090 * S7654321 SEDCBA98
|
||
|
2100 *--------------------------------
|
||
|
2110 MOVE.LEFT.OR.RIGHT
|
||
|
2120 BPL MOVE.RIGHT + MOVE RIGHT, - MOVE LEFT
|
||
|
2130 LDA MON.HMASK MOVE LEFT ONE PIXEL
|
||
|
2140 LSR SHIFT MASK RIGHT, MOVES DOT LEFT
|
||
|
2150 BCS LR.2 ...DOT MOVED TO NEXT BYTE
|
||
|
2160 EOR #$C0 MOVE SIGN BIT BACK WHERE IT WAS
|
||
|
2170 LR.1 STA MON.HMASK NEW MASK VALUE
|
||
|
2180 RTS
|
||
|
2190 LR.2 DEY MOVED TO NEXT BYTE, SO DECR INDEX
|
||
|
2200 BPL LR.3 STILL NOT PAST EDGE
|
||
|
2210 LDY #39 OFF LEFT EDGE, SO WRAP AROUND SCREEN
|
||
|
2220 LR.3 LDA #$C0 NEW HMASK, RIGHTMOST BIT ON SCREEN
|
||
|
2230 LR.4 STA MON.HMASK NEW MASK AND INDEX
|
||
|
2240 STY HGR.HORIZ
|
||
|
2250 LDA HGR.BITS ALSO NEED TO ROTATE COLOR
|
||
|
2260 *--------------------------------
|
||
|
2270 COLOR.SHIFT
|
||
|
2280 ASL ROTATE LOW-ORDER 7 BITS
|
||
|
2290 CMP #$C0 OF HGR.BITS ONE BIT POSN.
|
||
|
2300 BPL .1
|
||
|
2310 LDA HGR.BITS
|
||
|
2320 EOR #$7F
|
||
|
2330 STA HGR.BITS
|
||
|
2340 .1 RTS
|
||
|
2350 *--------------------------------
|
||
|
2360 * MOVE RIGHT ONE PIXEL
|
||
|
2370 * IF ALREADY AT RIGHT EDGE, WRAP AROUND
|
||
|
2380 *--------------------------------
|
||
|
2390 MOVE.RIGHT
|
||
|
2400 LDA MON.HMASK
|
||
|
2410 ASL SHIFTING BYTE LEFT MOVES PIXEL RIGHT
|
||
|
2420 EOR #$80
|
||
|
2430 * ORIGINAL: C0 A0 90 88 84 82 81
|
||
|
2440 * SHIFTED: 80 40 20 10 08 02 01
|
||
|
2450 * EOR #$80: 00 C0 A0 90 88 84 82
|
||
|
2460 BMI LR.1 FINISHED
|
||
|
2470 LDA #$81 NEW MASK VALUE
|
||
|
2480 INY MOVE TO NEXT BYTE RIGHT
|
||
|
2490 CPY #40 UNLESS THAT IS TOO FAR
|
||
|
2500 BCC LR.4 NOT TOO FAR
|
||
|
2510 LDY #0 TOO FAR, SO WRAP AROUND
|
||
|
2520 BCS LR.4 ...ALWAYS
|
||
|
2530 *--------------------------------
|