jmechner April 17, 2012
Attempted line ending fix

0 contributors

## Users on GitHub who have contributed to this file

100755 884 lines (730 sloc) 10.522 kb

- Edit this file
- Raw
- Blame
- History

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    * unpack 3.5ThreeFive = 1org = $ea00 lst off*-------------------------------**  Sits in main l.c. bank 2**------------------------------- org org
     jmp SNGEXPAND jmp DBLEXPAND jmp DELTAEXPPOP jmp INVERTY jmp DELTAEXPWIPE
     jmp PURPLE jmp PROMPT jmp BLACKOUT jmp CLR jmp TEXT
     jmp SETDHIRES jmp FADEIN jmp LOADSUPER jmp FADEOUT
    *------------------------------- lst put gameeq lst put eq lst off
    IOUDISoff = $c07fIOUDISon = $c07eDHIRESoff = $c05fDHIRESon = $c05eHIRESon = $c057HIRESoff = $c056PAGE2on = $c055PAGE2off = $c054MIXEDon = $c053MIXEDoff = $c052TEXTon = $c051TEXToff = $c050ALTCHARon = $c00fALTCHARoff = $c00eADCOLon = $c00dADCOLoff = $c00cALTZPon = $c009ALTZPoff = $c008RAMWRTaux = $c005RAMWRTmain = $c004RAMRDaux = $c003RAMRDmain = $c002ADSTOREon = $c001ADSTOREoff = $c000
    RWBANK2 = $c083RWBANK1 = $c08b
    *-------------------------------* RW18 ID bytes
    POPside1 = $a9POPside2 = $ad
    * RW18 zero page vars
    slot = $fdtrack = $felastrack = $ff
    * RW18 commands
    DrvOn = $00DrvOff = $01Seek = $02RdSeqErr = $03RdGrpErr = $04WrtSeqErr = $05WrtGrpErr = $06ModID = $07RdSeq = $83RdGrp = $84WrtSeq = $85WrtGrp = $86Inc = $40 ;.Inc to inc track
    *-------------------------------**  Unpack single hi-res screen into page 1*  (Sorry about the code--it's lifted directly from DRAZ)**------------------------------- dum $00
    PAC ds 2PIC ds 2V2 ds 1V3 ds 1V4 ds 1V5 ds 1V8 ds 1V9 ds 1VA ds 1VB ds 1VC ds 1
     dend
    *-------------------------------SNGEXPAND sta RAMRDaux sta RAMWRTmain
     STA PAC+1 ;org addr
     LDA #$20 STA PIC+1 ;dest addr
     LDA #0 STA PAC STA PIC
     LDA #$FE STA V8 LDA #0 STA VA LDY #$27:4 LDA #$78 STA V2 LDA #$20 STA V3:0 LDA V2 SEC SBC #$28 STA V2 BCS :1 DEC V3:1 LDA V2 STA V4 LDA V3 CLC ADC #4 STA V5:2 LDA V4 SEC SBC #$80 STA V4 BCS :3 DEC V5:3 LDA V4 STA PIC LDA V5 CLC ADC #$20 STA PIC+1:5 LDA PIC+1 SEC SBC #4 STA PIC+1 CLC BCC :6:13 LDA PIC+1 CMP V5 BNE :5 LDA V4 CMP V2 BNE :2 LDA V5 CMP V3 BNE :2 LDA V2 BNE :0 DEY BPL :4 RTS:6 BIT VA BMI :11 LDX #0 LDA (PAC,X) STA VB CMP V8 BNE :10 INC PAC BNE :7 INC PAC+1:7 LDA (PAC,X) STA V9 INC PAC BNE :8 INC PAC+1:8 LDA (PAC,X) STA VB INC PAC BNE :9 INC PAC+1:9 LDA #$80 STA VA CLC BCC :11:10 LDA VB ORA #$80 STA (PIC),Y INC PAC BNE :12 INC PAC+1:12 CLC BCC :13:11 LDA VB ORA #$80 STA (PIC),Y DEC V9 BNE :13 LDA #0 STA VA BEQ :13
    *-------------------------------**  Unpack crunched double hi-res screen**  Robert A. Cook 3/89**  In: A = hi byte of crunched data address*      RAMRD set to main/aux depending on where crunched*        data is stored**-------------------------------
     dum $f0
    CrnDatPtr ds 2XClmPos ds 1YScrPos ds 1ByteHld ds 1RepeatCdn ds 1ScrBasPtr ds 2
     dend
    *-------------------------------DBLEXPAND sta CrnDatPtr+1
     lda #1 sta CrnDatPtr;(CrnDatPtr),0 is crunch type (unused) jmp WipeRgtExp
    *-------------------------------**  Wipe Right Expand**-------------------------------WipeRgtExp lda #0 sta XClmPos
    :Loop lda #0 sta YScrPos jsr ExpandClm
     lda #1 sta YScrPos jsr ExpandClm
     inc XClmPos
     lda XClmPos cmp #80 bne :Loop
    ]rts rts
    *-------------------------------**  Delta Expand**  In: A = hi byte of crunched data address (in auxmem)**-------------------------------DeltaExp sta RAMRDaux
     sta CrnDatPtr+1
     lda #0 sta CrnDatPtr
     sta XClmPos
    :Loop ldy #0 lda (CrnDatPtr),y cmp #-1 beq :Done
     sta ByteHld and #$80 beq :ExpandOne
     lda ByteHld and #$7f beq :NewCoord
     tax
     ldy #1 lda (CrnDatPtr),y jsr ExpClmSeq1
     clc lda CrnDatPtr adc #2 sta CrnDatPtr bcc :a4 inc CrnDatPtr+1:a4 jmp :Next
    :NewCoord ldy #1 lda (CrnDatPtr),y sta XClmPos
     ldy #2 lda (CrnDatPtr),y sta YScrPos
     clc lda CrnDatPtr adc #3 sta CrnDatPtr bcc :a7 inc CrnDatPtr+1:a7 jmp :Next
    :ExpandOne lda ByteHld ldx #1 jsr ExpClmSeq1
     inc CrnDatPtr bne :sysi8 inc CrnDatPtr+1:sysi8
    :Next lda XClmPos cmp #$80 bne :Loop
    :Done sta RAMRDmain]rts rts
    *-------------------------------**  Expand Column**-------------------------------ExpandClm
    :Loop ldy #0 lda (CrnDatPtr),y sta ByteHld and #$80 beq :ExpandOne
     ldy #1 lda (CrnDatPtr),y tax lda ByteHld and #$7f jsr ExpClmSeq
     clc lda CrnDatPtr adc #2 sta CrnDatPtr bcc :a4 inc CrnDatPtr+1:a4 jmp :Next
    :ExpandOne lda ByteHld ldx #1 jsr ExpClmSeq
     inc CrnDatPtr bne :sysi5 inc CrnDatPtr+1:sysi5
    :Next lda YScrPos cmp #192 bcc :Loop
     rts
    *-------------------------------**  Expand Column Sequence**-------------------------------**  In: XClmPos*      YScrPos*      A (byte pattern)*      X (repeat count)**  Out: YScrPos (modified)**-------------------------------ExpClmSeq sta ByteHld stx RepeatCdn
    :Loop ldx XClmPos ldy YScrPos lda ByteHld jsr PutScrByte
     lda YScrPos clc adc #2 sta YScrPos
     dec RepeatCdn bne :Loop
     rts
    *-------------------------------** Expand Column Sequence 1**-------------------------------ExpClmSeq1 sta ByteHld stx RepeatCdn
    :Loop ldx XClmPos ldy YScrPos lda ByteHld bmi :Next
     jsr PutScrByte
    :Next inc YScrPos
     lda YScrPos cmp #192 bne :SkipXInc
     lda #0 sta YScrPos
     inc XClmPos
    :SkipXInc dec RepeatCdn bne :Loop
     rts
    *-------------------------------**  Put DHires Byte Value**-------------------------------**  In:  X (XClmPos)*       Y (YScrPos)*       A (Byte value)**-------------------------------PutScrByte sta ByteHld ;YScrPos in Y lda YLO,y sta ScrBasPtr lda YHI,y ora #$20 ;DHires page 1 sta ScrBasPtr+1
     txa ;XClmPos in X lsr tay bcs NoAuxSet
     sta RAMWRTaux
    NoAuxSet lda ByteHld sta (ScrBasPtr),y
     sta RAMWRTmain
    ]rts rts
    *-------------------------------** P U R P L E**------------------------------- do ThreeFivePURPLE rts
     else put purple fin
    *-------------------------------**  Delta Expand (Pop or Wipe)**  In: A = hi byte of crunched data address (in auxmem)**-------------------------------DELTAEXPPOP sta PAGE2on]DE jsr DeltaExp sta PAGE2off sta RAMRDaux sta RAMWRTaux]rts rts
    DELTAEXPWIPE sta PAGE2off jmp ]DE
    *-------------------------------** Invert Y-tables**-------------------------------INVERTY ldx #191 ;low line ldy #0 ;high line
    * Switch low & high lines
    :loop lda YLO,x pha lda YLO,y sta YLO,x pla sta YLO,y
     lda YHI,x pha lda YHI,y sta YHI,x pla sta YHI,y
    * Move 1 line closer to ctr
     dex iny cpy #96 bcc :loop]rts rts
    *-------------------------------** Prompt user to insert correct disk side**------------------------------- do ThreeFivemsg1 asc "    Insert Prince of Persia Disk@" elsemsg1 asc "Insert Prince of Persia Disk, Side " fin
    msg2 asc "C@"
    *-------------------------------PROMPT lda #"A" ldx BBundID cpx #POPside1 beq :1 lda #"B":1 sta msg2 ;side A or B?
     jsr blackout
     sta RAMWRTmain
     ldx #0:loop lda msg1,x cmp #"@" beq :done sta $528+2,x ;midscrn inx bpl :loop
    :done sta RAMWRTaux jsr whoop ;whoop spkr
    :wloop lda $c000 ora $c061 ora $c062 bpl :wloop sta $c010
     jmp clr ;clear screen
    *-------------------------------CLR bit RWBANK2 bit RWBANK2
     sta $c010
     lda #" " jmp _lrcls ;in hires
    *-------------------------------** Show black screen (text page 1)**-------------------------------BLACKOUT jsr CLR
    TEXT sta RAMRDaux jsr vblank sta TEXTon sta ADCOLoff sta PAGE2off]rts rts
    *-------------------------------* Set dbl hires*-------------------------------SETDHIRES sta RAMRDaux sta RAMWRTaux jsr vblank sta ADCOLon bit HIRESon
     bit DHIRESon bit DHIRESoff bit DHIRESon bit DHIRESoff bit DHIRESon ;for old Apple RGB card
     sta TEXToff rts
    ****************************************************************************************************************************************************** xc xc
    stlx mac bank;addr hex 9f da ]2 db ]1 <<<ldlx mac bank;addr hex bf da ]2 db ]1 <<<
    *-------------------------------** FADE IN** In: s-hires data in $2000.9FFF*     A = 0 main, 1 aux**-------------------------------FADEIN sta RAMRDmain sta :sm1+2 sta :sm2+2
     clc xce
     sep $30 ;axy
     lda #%00011110 sta $C035 ;shadow reg lda #$41 sta $C029 ;SH reg
     rep $30 ;AXY
    * Clear scan line control byte table* and palette 0 to black
     lda #$0000 ldx #$011E:scbclr dex dex stlx $E1;$9D00 bne :scbclr
    * Now move data over
     ldx #$2000 ldy #$2000 lda #32000-1 phb:sm1 mvn $E1,1 ;main/aux plb
    * Turn on Super Hires mode
     sep $20 lda #$C1 sta $C029 rep $20
    * Move desired palette over to PalFade area
     ldx #$9D00 ;aux mem ldy #new_palette lda #32-1 phb:sm2 mvn 0,1 ;aux to main/aux plb
    * Now fade in the picture
     bra PalFade ;switches back to e-mode
    *-------------------------------** FADE OUT**-------------------------------FADEOUT mx 3
    * Clear the "destination" palette back to zero
     ldx #31 lda #$00:palclr sta new_palette,x dex bpl :palclr
    * Now fade out
     bra PalFade ;switches back to e-mode
    *------------------------------------------------- PalFade** Given current palette at $E19E00.1F, fade to* new palette given in new_palette*
    new_palette ds 32
    PalFade dum 0:green ds 1:blue ds 1 dend
     sec xce
     bit $C019 bmi *-3
     ldy #16
    :fadein ldx #3
    :fadein2 bit $C019 bpl *-3
     bit $C019 bmi *-3
     dex bne :fadein2
     ldx #30:palloop ldlx $E1;$9E01 and #$0f cmp new_palette+1,x beq :red_ok inc blt :red_ok dec dec
    :red_ok stlx $E1;$9E01
     lda new_palette,x and #$F0 sta :green
     ldlx $E1;$9E00 and #$F0 cmp :green beq :green_ok blt :grn_add sbc #$20:grn_add clc adc #$10
    :green_ok sta :green
     lda new_palette,x and #$0F sta :blue
     ldlx $E1;$9E00 and #$0F cmp :blue beq :blue_ok inc blt :blue_ok dec dec
    :blue_ok ora :green stlx $E1;$9E00
     dex dex bpl :palloop
     dey bpl :fadein
     rts
     xc off mx 3
    *===============================** Load super hi-res data**-------------------------------LOADSUPER jsr rw18 db ModID,$79 ;set "side C"
     lda #0 sta track sta RAMWRTmain jsr loadscrn ;"Tracks" 0-6: palace (mainmem)
     sta RAMWRTaux jmp loadscrn ;"Tracks" 7-13: epilog (auxmem)
    *-------------------------------** Load super hi-res screen into $2000.9FFF**-------------------------------loadscrn lda #$20:loop sta :sm jsr rw18 db RdSeq.Inc:sm db $20 lda :sm clc adc #$12 cmp #$9e bcc :loop ;load 7 tracks]rts rts
    *------------------------------- lsteof ds 1 usr $a9,2,$a00,*-org lst off

## Keyboard Shortcuts (see all)

### Site wide shortcuts

s
  Focus site search

?
  Bring up this help dialog

### Commit list

j
  Move selection down

k
  Move selection up

c or o or enter
  Open commit

y
  Expand URL to its canonical form

### Pull request list

j
  Move selection down

k
  Move selection up

o or enter
  Open issue

⌘ctrl + enter
  Submit comment

### Issues

j
  Move selection down

k
  Move selection up

x
  Toggle selection

o or enter
  Open issue

⌘ctrl + enter
  Submit comment

I
  Mark selection as read

U
  Mark selection as unread

y
  Remove selection from view

c
  Create issue

l
  Create label

i
  Back to inbox

u
  Back to issues

/
  Focus issues search

### Issues Dashboard

j
  Move selection down

k
  Move selection up

o or enter
  Open issue

### Network Graph

← or h
  Scroll left

→ or l
  Scroll right

↑ or k
  Scroll up

↓ or j
  Scroll down

t
  Toggle visibility of head labels

shift ← or shift h
  Scroll all the way left

shift → or shift l
  Scroll all the way right

shift ↑ or shift k
  Scroll all the way up

shift ↓ or shift j
  Scroll all the way down

### Source Code Browsing

t
  Activates the file finder

l
  Jump to line

w
  Switch branch/tag

y
  Expand URL to its canonical form

### Browsing Commits

⌘ctrl + enter
  Submit comment

escape
  Close form

## Markdown Cheat Sheet

### Format Text

Headers

    # This is an <h1> tag
    ## This is an <h2> tag
    ###### This is an <h6> tag

Text styles

    *This text will be italic*
    _This will also be italic_
    **This text will be bold**
    __This will also be bold__

    *You **can** combine them*

### Lists

Unordered

    * Item 1
    * Item 2
      * Item 2a
      * Item 2b

Ordered

    1. Item 1
    2. Item 2
    3. Item 3
       * Item 3a
       * Item 3b

### Miscellaneous

Images

    ![GitHub Logo](/images/logo.png)
    Format: ![Alt Text](url)

Links

    http://github.com - automatic!
    [GitHub](http://github.com)

Blockquotes

    As Kanye West said:

    > We're living the future so
    > the present is our past.

### Code Examples in Markdown

Syntax highlighting with GFM

    ```javascript
    function fancyAlert(arg) {
      if(arg) {
        $.facebox({div:'#foo'})
      }
    }
    ```

Or, indent your code 4 spaces

    Here is a Python code example
    without syntax highlighting:

        def foo:
          if not bar:
            return true

Inline code for comments

    I think you should use an
    `<addr>` element here instead.

Something went wrong with that request. Please try again. Dismiss

## Looking for the GitHub logo?

- #### GitHub Logo

  Download

- #### The Octocat

  Download