jmechner April 17, 2012
Attempted line ending fix

0 contributors

## Users on GitHub who have contributed to this file

100755 1956 lines (1617 sloc) 27.571 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
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255
    1256
    1257
    1258
    1259
    1260
    1261
    1262
    1263
    1264
    1265
    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    1274
    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    1284
    1285
    1286
    1287
    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
    1306
    1307
    1308
    1309
    1310
    1311
    1312
    1313
    1314
    1315
    1316
    1317
    1318
    1319
    1320
    1321
    1322
    1323
    1324
    1325
    1326
    1327
    1328
    1329
    1330
    1331
    1332
    1333
    1334
    1335
    1336
    1337
    1338
    1339
    1340
    1341
    1342
    1343
    1344
    1345
    1346
    1347
    1348
    1349
    1350
    1351
    1352
    1353
    1354
    1355
    1356
    1357
    1358
    1359
    1360
    1361
    1362
    1363
    1364
    1365
    1366
    1367
    1368
    1369
    1370
    1371
    1372
    1373
    1374
    1375
    1376
    1377
    1378
    1379
    1380
    1381
    1382
    1383
    1384
    1385
    1386
    1387
    1388
    1389
    1390
    1391
    1392
    1393
    1394
    1395
    1396
    1397
    1398
    1399
    1400
    1401
    1402
    1403
    1404
    1405
    1406
    1407
    1408
    1409
    1410
    1411
    1412
    1413
    1414
    1415
    1416
    1417
    1418
    1419
    1420
    1421
    1422
    1423
    1424
    1425
    1426
    1427
    1428
    1429
    1430
    1431
    1432
    1433
    1434
    1435
    1436
    1437
    1438
    1439
    1440
    1441
    1442
    1443
    1444
    1445
    1446
    1447
    1448
    1449
    1450
    1451
    1452
    1453
    1454
    1455
    1456
    1457
    1458
    1459
    1460
    1461
    1462
    1463
    1464
    1465
    1466
    1467
    1468
    1469
    1470
    1471
    1472
    1473
    1474
    1475
    1476
    1477
    1478
    1479
    1480
    1481
    1482
    1483
    1484
    1485
    1486
    1487
    1488
    1489
    1490
    1491
    1492
    1493
    1494
    1495
    1496
    1497
    1498
    1499
    1500
    1501
    1502
    1503
    1504
    1505
    1506
    1507
    1508
    1509
    1510
    1511
    1512
    1513
    1514
    1515
    1516
    1517
    1518
    1519
    1520
    1521
    1522
    1523
    1524
    1525
    1526
    1527
    1528
    1529
    1530
    1531
    1532
    1533
    1534
    1535
    1536
    1537
    1538
    1539
    1540
    1541
    1542
    1543
    1544
    1545
    1546
    1547
    1548
    1549
    1550
    1551
    1552
    1553
    1554
    1555
    1556
    1557
    1558
    1559
    1560
    1561
    1562
    1563
    1564
    1565
    1566
    1567
    1568
    1569
    1570
    1571
    1572
    1573
    1574
    1575
    1576
    1577
    1578
    1579
    1580
    1581
    1582
    1583
    1584
    1585
    1586
    1587
    1588
    1589
    1590
    1591
    1592
    1593
    1594
    1595
    1596
    1597
    1598
    1599
    1600
    1601
    1602
    1603
    1604
    1605
    1606
    1607
    1608
    1609
    1610
    1611
    1612
    1613
    1614
    1615
    1616
    1617
    1618
    1619
    1620
    1621
    1622
    1623
    1624
    1625
    1626
    1627
    1628
    1629
    1630
    1631
    1632
    1633
    1634
    1635
    1636
    1637
    1638
    1639
    1640
    1641
    1642
    1643
    1644
    1645
    1646
    1647
    1648
    1649
    1650
    1651
    1652
    1653
    1654
    1655
    1656
    1657
    1658
    1659
    1660
    1661
    1662
    1663
    1664
    1665
    1666
    1667
    1668
    1669
    1670
    1671
    1672
    1673
    1674
    1675
    1676
    1677
    1678
    1679
    1680
    1681
    1682
    1683
    1684
    1685
    1686
    1687
    1688
    1689
    1690
    1691
    1692
    1693
    1694
    1695
    1696
    1697
    1698
    1699
    1700
    1701
    1702
    1703
    1704
    1705
    1706
    1707
    1708
    1709
    1710
    1711
    1712
    1713
    1714
    1715
    1716
    1717
    1718
    1719
    1720
    1721
    1722
    1723
    1724
    1725
    1726
    1727
    1728
    1729
    1730
    1731
    1732
    1733
    1734
    1735
    1736
    1737
    1738
    1739
    1740
    1741
    1742
    1743
    1744
    1745
    1746
    1747
    1748
    1749
    1750
    1751
    1752
    1753
    1754
    1755
    1756
    1757
    1758
    1759
    1760
    1761
    1762
    1763
    1764
    1765
    1766
    1767
    1768
    1769
    1770
    1771
    1772
    1773
    1774
    1775
    1776
    1777
    1778
    1779
    1780
    1781
    1782
    1783
    1784
    1785
    1786
    1787
    1788
    1789
    1790
    1791
    1792
    1793
    1794
    1795
    1796
    1797
    1798
    1799
    1800
    1801
    1802
    1803
    1804
    1805
    1806
    1807
    1808
    1809
    1810
    1811
    1812
    1813
    1814
    1815
    1816
    1817
    1818
    1819
    1820
    1821
    1822
    1823
    1824
    1825
    1826
    1827
    1828
    1829
    1830
    1831
    1832
    1833
    1834
    1835
    1836
    1837
    1838
    1839
    1840
    1841
    1842
    1843
    1844
    1845
    1846
    1847
    1848
    1849
    1850
    1851
    1852
    1853
    1854
    1855
    1856
    1857
    1858
    1859
    1860
    1861
    1862
    1863
    1864
    1865
    1866
    1867
    1868
    1869
    1870
    1871
    1872
    1873
    1874
    1875
    1876
    1877
    1878
    1879
    1880
    1881
    1882
    1883
    1884
    1885
    1886
    1887
    1888
    1889
    1890
    1891
    1892
    1893
    1894
    1895
    1896
    1897
    1898
    1899
    1900
    1901
    1902
    1903
    1904
    1905
    1906
    1907
    1908
    1909
    1910
    1911
    1912
    1913
    1914
    1915
    1916
    1917
    1918
    1919
    1920
    1921
    1922
    1923
    1924
    1925
    1926
    1927
    1928
    1929
    1930
    1931
    1932
    1933
    1934
    1935
    1936
    1937
    1938
    1939
    1940
    1941
    1942
    1943
    1944
    1945
    1946
    1947
    1948
    1949
    1950
    1951
    1952
    1953
    1954
    1955
    * autoDemoDisk = 0org = $5400 tr on lst off*-------------------------------**  PRINCE OF PERSIA*  Copyright 1989 Jordan Mechner**------------------------------- org org
     jmp AUTOCTRL jmp CHECKSTRIKE jmp CHECKSTAB jmp AUTOPLAYBACK jmp CUTCHECK
     jmp CUTGUARD jmp ADDGUARD jmp CUT
    *------------------------------- lst put eq lst put gameeq lst put seqdata lst put soundnames lst put movedata lst off
     dum $f0ztemp ds 1prob ds 1]cutdir ds 1ProgStart ds 2 dend
    plus1 db -1,1minus1 db 1,-1
    * Thresholds for cut to new screen
    TopCutEdgePl = ScrnTop+10TopCutEdgeMi = ScrnTop-16BotCutEdge = ScrnBottom+24
    LeftCutEdge = ScrnLeft-4RightCutEdge = ScrnRight+4
    *-------------------------------* Locations of special objects
    flaskscrn = 24flaskx = 3flasky = 0
    mirscrn = 4mirx = 4miry = 0
    swordscrn = 15swordx = 1swordy = 0
    mousetimer = 150 ;from topctrl
    *-------------------------------* Strike/block ranges
    strikerange1 = 12strikerange2 = 29blockrange1 = 0blockrange2 = 29 ;from TestStrike
    *-------------------------------* Other constants:
    swordthres = 90engardethres = 60strikethres1 = strikerange1strikethres2 = strikerange2blockthres1 = 10blockthres2 = blockrange2tooclose = strikethres1toofar = strikethres2+6 ;min dist at which you can advance safelyoffguardthres = 8jumpthres = 50runthres = 40blocktime = 4
    *-------------------------------** Fighter params (indexed by guardprog #)** strikeprob = probability x255 of striking from ready posn* restrikeprob = prob x 255 of restriking after blocking* blockprob  = prob x255 of blocking opponent's strike* advprob = of advancing to within striking range* refractimer = length of refractory period after being hit**               0   1   2   3   4   5   6   7   8   9   10  11
    strikeprob db 075,100,075,075,075,050,100,220,000,060,040,060restrikeprob db 000,000,000,005,005,175,020,010,000,255,255,150blockprob db 000,150,150,200,200,255,200,250,000,255,255,255impblockprob db 000,075,075,100,100,145,100,250,000,145,255,175advprob db 255,200,200,200,255,255,200,000,000,255,100,100refractimer db 020,020,020,020,010,010,010,010,000,010,000,000specialcolor db 000,000,000,001,000,001,001,000,000,000,000,001extrastrength db 000,000,000,000,001,000,000,000,000,000,000,000
    numprogs = 12
    *-------------------------------* Basic guard strength & uniform color (indexed by level #)
    basicstrength db 4,3,3,3,3,4,5 ;levels 0-6 db 4,4,5,5,5,4,6 ;levels 7-13
    basiccolor db 1,0,0,0,1,1,1 ;0 = blue, 1 = red db 0,0,0,1,1,0,0
    shadstrength = 4
    *-------------------------------** 10: kid (demo)* 11: enemy (demo)**-------------------------------**  Automatic enemy control routine**  In: Char vars reflect position in PRECEDING frame;*      Op vars reflect position in UPCOMING frame*      guardprog = program #**  (Exception: When used by kid fighting in demo, both*  Char & Op vars reflect preceding frame.)**-------------------------------]rts rts
    AUTOCTRL jsr DoRelease
     lda CharID beq :5 ;control kid in demo
     lda justblocked beq :jb0 dec justblocked
    :jb0 lda gdtimer beq :gt0 dec gdtimer:gt0 lda refract ;refractory period after being hit beq :2 dec refract:2 lda CharID cmp #24 ;mouse? beq :6 cmp #4 ;skel? beq :3 cmp #2 ;guard? bcc :1 lda level cmp #13 ;vizier? beq :4 jmp GuardProg:1 jmp ShadowProg:3 jmp SkelProg:4 jmp VizierProg:5 jmp KidProg:6 jmp MouseProg
    *-------------------------------*  M O U S E*-------------------------------MouseProg lda CharFace cmp #86 beq ]rts lda CharAction beq :1 ;already stopped lda CharX cmp #166 bcs ]rts lda #Mleave jsr jumpseq jmp animchar ;sets CharAction = 0
    :1 lda CharX cmp #200 bcc ]rts jmp VanishChar
    *-------------------------------*  S H A D O W M A N*------------------------------- do DemoDiskShadowProgSkelProgVizierProg brk
     elseShadowProg lda level cmp #4 bne :0 jmp ShadLevel4
    :0 cmp #5 bne :1 jmp ShadLevel5
    :1 cmp #6 bne :2 jmp ShadLevel6
    :2 cmp #12 bne :3 jmp FinalShad:3]rts rts
    *-------------------------------* Level-specific code for:* Level 6 (plunge)*-------------------------------ShadLevel6 lda CharScrn cmp #1 beq Shad6a rts
    * Level 6, screen 1* When kid jumps chasm, step on plate
    Shad6a lda KidPosn cmp #43 bne ]rts lda KidX cmp #$80 bcs ]rts jsr DoPress jmp DoFwd ;step fwd
    *-------------------------------* Level 5 (THIEF)*-------------------------------ShadLevel5 lda CharScrn cmp #flaskscrn beq Shad5]rts rts
    * Level 5, screen 24* When gate opens, steal potion
    Shad5 lda PlayCount bne :1 ;continue playback
     lda #flaskscrn ldx #1 ;x ldy #0 ;y jsr rdblock ;gate lda (BlueSpec),y cmp #20 bcc ]rts;begin playback lda #0 sta PreRecPtr
    :1 lda #ShadProg5 ldx #>ShadProg5 jsr AutoPlayback
     lda CharX cmp #15 bcs ]rts jmp VanishChar
    *-------------------------------* Level 4 (mirror)*-------------------------------ShadLevel4 lda CharScrn cmp #4 bne ]rts lda CharX cmp #80 bcc :gone jmp DoFwd ;run o.s.:gone jmp VanishChar
    *-------------------------------* Level 12 (final battle)*-------------------------------FinalShad
    * Screen 15: Jump on top of kid
     lda CharScrn cmp #swordscrn bne :cont lda shadowaction bne :cont ;already did it lda OpX cmp #150 bcs :hold ;hold shad at top until kid arrives
     lda #1 sta shadowaction bne :cont
    :hold lda #shadpos12 ldx #>shadpos12 jmp csps]rts rts
    * Continue
    :cont lda CharSword cmp #2 bcs :fight lda OpSword cmp #2 bcs :hostile lda offguard bne :face:hostile lda EnemyAlert cmp #2 bcc :2 jsr getopdist cmp #swordthres bcs :2 ;wait until kid gets close
     lda CharPosn cmp #15 bne ]rts jmp DoEngarde ;draw on kid
    * turn to face kid
    :2 jsr getopdist bpl ]rts jmp DoBack
    * Normal fighting
    :fight lda offguard beq :1 ;has kid put up sword? lda refract bne :1 ;yes--wait a moment-- jmp DoDown ;--then lower your guard
    :1 jmp EnGarde ;normal fighting
    * Face to face--swords down
    :face jsr getopdist bmi :merge ;whammo!
     lda EnemyAlert cmp #2 bne :wait lda OpPosn cmp #3 bcc :wait cmp #15 bcc :go cmp #127 bcc :wait cmp #133 bcs :wait
    * If kid starts moving towards you, reciprocate* (Accept startrun & stepfwd)
    :go jmp DoFwd
    * Kid & shadow reunite
    :merge lda #$ff ;white sta lightcolor lda #10 sta lightning
     jsr boostmeter
     lda #s_Rejoin ldx #85 jsr cuesong
     lda #42 sta mergetimer
     lda #0 sta CharID jsr SaveKid ;shadow turns into kid jmp VanishChar:wait]rts rts
    *-------------------------------* S K E L E T O N*-------------------------------SkelProg lda #2 sta CharSword jmp GuardProg
    *-------------------------------* V I Z I E R*-------------------------------VizierProg jmp GuardProg
     fin ;DemoDisk
    *-------------------------------* K I D (in demo)*-------------------------------KidProg jmp GuardProg
    *-------------------------------* G U A R D*-------------------------------GuardProg lda CharSword cmp #2 ;Are you already en garde? bcc Alert ;no jmp EnGarde ;yes]rts rts
    *-------------------------------** Alert (not en garde)**-------------------------------Alert lda KidLife bpl ]rts ;kid's dead--relax
    * If kid is behind you, turn to face him
     jsr getopdist ldx OpBlockY cpx CharBlockY bne :difflevel cmp #-8 ;if kid is right on top of you, go en garde! bcs :eng:difflevel ldx alertguard beq :ok ;otherwise wait for a sound to alert you ldx #0 stx alertguard:alert cmp #128 bcc :eng cmp #-4 bcs :ok ;overlapping--stand still jmp DoTurn ;turn around
    * If you can see kid, go en garde
    :ok cmp #128 bcs ]rts ;kid is behind you
    :eng lda EnemyAlert beq ]rts
     lda level cmp #13 bne :1 ;Vizier only: wait for music to finish lda SongCue bne ]rts
    :1 jmp DoEngarde]rts rts
    *-------------------------------** En garde**-------------------------------EnGarde lda CharPosn cmp #166 beq ]rts cmp #150 bcc ]rts ;wait till you're ready
     lda EnemyAlert cmp #2 bcs :ea2 cmp #1 ;EnemyAlert = 1: Kid is in sight, but a beq ]rts ;gap or barrier separates you--stay put
    * Kid is out of sight (EnemyAlert = 0)* If kid has "dropped out" of fight, follow him down
     lda droppedout ;flag set by CHECKFLOOR beq :1 jmp FollowKid
    * else return to alert position
    :1 lda CharID cmp #4 beq ]rts ;(except skeleton) jmp DoDropguard
    * EnemyAlert = 2: Clear stretch of floor to player
    * If kid is stunned, let him recover...
    :ea2 jsr getopdist bmi :norec cmp #12 bcc :norec ;unless he's right on top of you lda OpPosn cmp #102 bcc :norec cmp #118 bcs :norec lda OpAction cmp #5 beq ]rts:norec
    * Advance to closest safe distance
     jsr getopdist cmp #toofar bcs :outofrange
     ldx CharSword cpx #2 bcc :offg
     cmp #tooclose bcc :tooclose jmp InRange
    :offg cmp #offguardthres bcc :tooclose jmp InRange]rts rts
    * Out of range
    :outofrange lda refract bne ]rts
     lda CharFace cmp OpFace beq :nojump ;chase him
     lda OpPosn cmp #7 bcc :norun cmp #15 bcc :runwait:norun cmp #34 bcc :nojump cmp #44 bcc :jumpwait ;If kid is running towards you, stay put:nojump jsr getinfront jsr cmpspace ;Don't advance unless solid floor beq :gap jsr get2infront jsr cmpspace bne :solid
    :gap jmp DoRetreat:solid jmp DoAdvance
    * Kid is trying to get past you--cut him down!
    :jumpwait jsr getopdist cmp #jumpthres bcs ]rts ;wait jmp DoStrike
    :runwait jsr getopdist cmp #runthres bcs ]rts:strike jmp DoStrike
    * Too close to hit him
    :tooclose lda CharFace cmp OpFace beq :ret jmp DoAdvance:ret jmp DoRetreat
    *-------------------------------**  Kid has "dropped out" of fight*  Advance until you run out of floor--*  then decide whether to jump down after him**-------------------------------FollowKid lda OpAction cmp #2 beq :hanging cmp #6 beq :hanging ;wait--kid is hanging on ledge
     jsr getinfront sta ztemp jsr cmpbarr bne :stopped lda ztemp jsr cmpspace beq :atedge jmp DoAdvance
    * At edge of floor.  Follow kid down ONLY if:* (1) it's a 1-story drop to solid floor* (2) kid is still down there
    :atedge jsr getinfront inc tempblocky jsr rdblock1 sta ztemp ;is it safe? cmp #spikes beq :stopped cmp #loose beq :stopped jsr cmpbarr bne :stopped lda ztemp jsr cmpspace beq :stopped
     lda CharBlockY clc adc #1 cmp OpBlockY bne :stopped ;kid's not down there
    * It looks safe--follow him down
     jmp DoAdvance
    :stopped lda #0 sta droppedout jmp DoRetreat ;so you can kill him if he climbs up:hanging]rts rts
    *-------------------------------**  In range**-------------------------------InRange lda OpSword ;is opponent armed & en garde? cmp #2 beq :fight ;yes
    * Opponent is unarmed or off guard--maul him!
     lda refract bne ]rts
     jsr getopdist cmp #strikethres2 bcc :1 jmp DoAdvance ;advance until within range...:1 jmp DoStrike ;then strike
    * Opponent is en garde--use strategy
    :fight jmp GenFight
    *-------------------------------** General Fighting Routine** (Fighters are en garde, face to face, and too close to* advance safely)**-------------------------------GenFight jsr getopdist cmp #blockthres1 bcc :outofrange cmp #blockthres2 bcs :outofrange
     jsr MaybeBlock ;block opponent's strike?
     lda refract bne ]rts
     jsr getopdist cmp #strikethres1 bcc :outofrange cmp #strikethres2 bcs :outofrange
     jmp MaybeStrike ;strike?
    :outofrange jmp MaybeAdvance ;advance to within strike range?]rts rts
    *-------------------------------** Advance to within strike range?* (Only consider it if gdtimer = 0)**-------------------------------MaybeAdvance lda guardprog beq :dumb ;Guard #0 is too dumb to care lda gdtimer bne ]rts
    :dumb jsr rndp cmp advprob,x bcs ]rts
     jmp DoAdvance
    *-------------------------------** Block opponent's strike?**-------------------------------MaybeBlock lda OpPosn cmp #152 ;guy4 beq :99 cmp #153 ;guy5 beq :99 cmp #162 ;guy22 (block to strike) bne ]rts
    :99 lda justblocked bne :impaired jsr rndp cmp blockprob,x bcc :block]rts rts
    :impaired jsr rndp cmp impblockprob,x bcs ]rts:block jmp DoBlock
    *-------------------------------** Strike?**-------------------------------MaybeStrike ldx OpPosn cpx #169 beq ]rts cpx #151 ;opponent starting to strike? beq ]rts ;yes--don't strike
     ldx CharPosn cpx #161 ;have I just blocked? beq :restrike cpx #150 beq :restrike ;yes--restrike?
     jsr rndp cmp strikeprob,x bcs ]rts jmp DoStrike
    :restrike jsr rndp cmp restrikeprob,x bcs ]rts jmp DoStrike
    *-------------------------------DoRelease lda #0 sta clrF sta clrB sta clrU sta clrD sta clrbtn sta JSTKX sta JSTKY sta btn rts
    DoAdvanceDoFwd lda #-1 sta clrF sta JSTKX rts
    DoRetreatDoBack lda #-1 sta clrB lda #1 sta JSTKX rts
    DoBlockDoUp lda #-1 sta clrU sta JSTKY rts
    DoTurnDoDown lda #-1 sta clrD lda #1 sta JSTKY rts
    DoStandup lda #-1 sta clrU jmp DoBack
    DoDropguardDoRunaway lda #-1 sta clrD jmp DoBack
    DoEngarde lda #-1 sta clrD jmp DoFwd
    DoStrikeDoPress lda #-1 sta clrbtn sta btn rts
    DoRelBtn lda #0 sta btn]rts rts
    *-------------------------------**  R N D P**  Return X = guardprog, A = rnd #**-------------------------------rndp ldx guardprog jmp rnd
    *-------------------------------**  C H E C K   S T R I K E**  Check for sword contact**  Going in: Kid & Shad vars represent position in*   UPCOMING frame**  Out: Kid & Shad vars*  (Return Action = 99 if stabbed)**-------------------------------CHECKSTRIKE lda KidPosn beq ]rts cmp #219 bcc :noclimb cmp #229 bcc ]rts ;on staircase:noclimb jsr LoadShadwOp jsr TestStrike jsr SaveShadwOp
     jsr LoadKidwOp jsr TestStrike jsr SaveKidwOp
    ]rts rts
    *-------------------------------TestStrike
     lda CharSword cmp #2 ;in fighting mode? bne ]rts ;no
     lda CharBlockY cmp OpBlockY bne ]rts
    * Am I on a test (strike) frame?
     lda CharPosn cmp #153 ;guy5 (frame before full ext.) beq :test cmp #154 ;guy6 (full ext.) bne ]rts
    * I'm striking--is opponent blocking?
    :test jsr getopdist cmp #blockrange1 bcc :nobloc
     cmp #blockrange2 bcs :nobloc
     lda OpPosn cmp #161 beq :11 cmp #150 ;blocking? bne  :nobloc ;no
    * Yes -- opponent blocks my strike
    :1 lda #161 sta OpPosn ;change opp to "successful block"
    :11 lda CharID beq :12 ;am I a guard? lda #blocktime ;yes--impair my blocking ability for a while sta justblocked
    :12 lda #blockedstrike jsr jumpseq jmp animchar
    * Skewer opponent?
    :nobloc lda CharPosn cmp #154 ;full ext bne ]rts
     jsr getopdist
     ldx OpSword cpx #2 bcs :ong cmp #offguardthres bcs :cont1 rts:ong cmp #strikerange1 bcc ]rts
    :cont1 cmp #strikerange2 bcs ]rts
     lda #99 "stabbed" sta OpAction]rts rts
    *-------------------------------*  C H E C K   S T A B*-------------------------------CHECKSTAB lda ShadAction cmp #99 bne :1
     lda KidAction cmp #99 beq :doublestab:2 jsr LoadShad jsr StabChar jsr SaveShad
     jsr rndp lda refractimer,x sta refract
    :1 lda KidAction cmp #99 bne ]rts
     jsr LoadKid jsr StabChar jmp SaveKid
    * Both chars finish lunge simultaneously
    :doublestab lda #1 sta KidAction bne :2 ;player wins a tie]rts rts
    *-------------------------------* Change shadowman posn* In: A-X = shadpos L-H* Out: Char data*-------------------------------chgshadposn sta ztemp stx ztemp+1 ldy #6:loop lda (ztemp),y sta Char,y dey bpl :loop
     ldy #7 lda (ztemp),y jsr jumpseq
     lda #1 sta CharID
     lda #0 sta PlayCount ;zero playback counter rts
    * ... & save
    csps jsr chgshadposn
     lda #3 sta guardprog
     lda #shadstrength sta MaxOppStr sta OppStrength
     jmp SaveShad
    *-------------------------------* (Posn, X, Y, Face, BlockX, BlockY, Action)*               0  1  2  3  4  5  6
    shadpos6a hex 0f,51,76,00,00,01,00 db stand
    shadpos5 hex 0f,37,37,00,ff,00,00 db stand ;just o.s. to L
    shadpos12 hex 0f,51,f0,00,00,00,00 db stepfall
    *-------------------------------EndProg = -2EndDemo = -1Ctr = 0Fwd = 1Back = 2Up = 3Down = 4Upfwd = 5Press = 6Release = 7
    * Commands:** -2 - end of programmed sequence* -1 - end of demo*  0 - center jstk & release btn*  1 - jstk fwd*  2 - jstk back*  3 - jstk up*  4 - jstk down*  5 - jstk up & fwd*  6 - press & hold btn*  7 - release btn
    *-------------------------------** Prerecorded sequence format:**  1.  Frame # (1 byte)*  2.  Command (1 byte)** 255 frames = approx. 25-30 seconds**-------------------------------* Level 5 (THIEF): Steal potion
    ShadProg5 db 0,Ctr db 1,Fwd db 14,Ctr db 18,Press db 29,Release db 45,Back db 49,Fwd db 255,EndProg
    *-------------------------------**  Play back prerecorded movement sequence**  In: A-X = program start addr*      PlayCount = frame #*      PreRecPtr = pointer to next command**-------------------------------AUTOPLAYBACK sta ProgStart stx ProgStart+1
    * Inc frame counter
     lda PlayCount cmp #254 bcs :rts inc PlayCount
    * Look up time of next command
     ldy PreRecPtr
     lda PlayCount cmp (ProgStart),y bcs :next
    * Not there yet--repeat last command
     dey lda (ProgStart),y jmp :ex
    * We're there--
    :next iny lda (ProgStart),y ;command iny sty PreRecPtr
    * Execute command
    :ex cmp #-1 beq :enddemo cmp #0 beq :ctr cmp #1 beq :fwd cmp #2 beq :back cmp #3 beq :up cmp #4 beq :down cmp #5 beq :upfwd cmp #6 beq :press cmp #7 beq :release:rts]rts rts
    * Commands
    :ctr jmp DoRelease:fwd jmp DoFwd:back jmp DoBack:up jmp DoUp:down jmp DoDown:upfwd jsr DoUp jmp DoFwd:press jmp DoPress:release jmp DoRelBtn
    :enddemo ; lda autopilot; bne :endpb jmp attractmode ;Game: end demo:endpb ; lda #0 ;Editor: end playback; sta autopilot; rts
    *-------------------------------**  C U T   C H E C K**  Cut with kid**-------------------------------CUTCHECK lda CUTTIMER beq :ok
     dec CUTTIMER]rts rts
    :ok jsr LoadKid jsr setupchar jsr getedges jsr cutchar ;cut with character bmi ]rts ;no cut sta ]cutdir
     jsr SaveKid
     lda CharScrn sta cutscrn
     lda ShadFace cmp #86 ;is there a guard on old screen? beq ]rts ;no
    * What to do with guard?  Two choices:**  (1) UPDATE -- leave guard behind on old screen (& update*      his coords so he'll still be there when we come back)*  (2) TRANSFER -- transfer guard to new screen (& delete his*      coords from old screen)
     lda ShadLife bpl :update ;dead guard on old screen--leave him behind
     lda ShadSword cmp #2 bne :update
    * Is there a live guard on new screen?
     ldx KidScrn lda GdStartBlock-1,x cmp #30 bcs :nonew ;no
     lda GdStartSeqH-1,x beq :update ;yes
    * If guard is too far o.s., leave him behind
    :nonew lda ]cutdir beq :left cmp #1 beq :right cmp #2 beq :up
    :down lda ShadBlockY cmp #3 bcs :transfer bcc :update
    :up lda ShadBlockY bmi :transfer bpl :update
    :right lda ShadX cmp #ScrnWidth+25 ;25 is safety factor bcc :update bcs :transfer
    :left lda ShadX cmp #256-ScrnWidth-25 bcs :update
    * Take him with us
    :transfer jmp transferguard
    * Leave him behind
    :update jmp updateguard
    *-------------------------------** Transfer guard from old screen to new screen* (Also remove any dead guards from new scrn)**-------------------------------transferguard lda #-1 ldx KidScrn ;new scrn sta GdStartBlock-1,x ldx ShadScrn ;old scrn sta GdStartBlock-1,x
     jsr LoadShad
     lda ]cutdir jsr cut
     jmp SaveShad
    ]rts rts
    *-------------------------------** Leaving guard behind on old screen--* update guard coords**-------------------------------
    updateguard lda ShadFace cmp #86 beq ]rts ;no guard lda ShadID cmp #1 beq ]rts ;not for shadman cmp #24 beq ]rts ;or mouse:gd lda #0 ;arbitrary--ADDGUARD will reconstruct sta tempblockx ;CharBlockX from CharX lda ShadBlockY sta tempblocky jsr indexblock tya ldx ShadScrn sta GdStartBlock-1,x
     lda ShadX sta GdStartX-1,x
     lda ShadFace sta GdStartFace-1,x
     lda guardprog sta GdStartProg-1,x
     lda ShadLife bpl :ok lda #0 sta GdStartSeqH-1,x beq :cont
    :ok lda ShadSeq sta GdStartSeqL-1,x lda ShadSeq+1 sta GdStartSeqH-1,x
    * and deactivate enemy char
    :cont lda #86 sta ShadFace
     lda #0 sta OppStrength]rts rts
    *-------------------------------** If enemy has fallen to screen below, catch him before* he wraps around to top of VisScrn**-------------------------------CUTGUARD lda ShadFace cmp #86 beq ]rts
     lda ShadY cmp #BotCutEdge bcc ]rts
    * If guard, remove him altogether
     lda ShadID cmp #4 beq :skel cmp #1 beq :shad
    ]RemoveGd jsr deadenemy ;music, etc.
     ldx VisScrn lda #-1 sta GdStartBlock-1,x lda #86 sta ShadFace lda #0 sta OppStrength lda #-1 sta ChgOppStr]rts rts
    * If shad, vanish him
    :shad lda ShadAction cmp #4 bne ]rts jsr LoadShad jsr VanishChar jmp SaveShad
    * If skel, change scrn
    :skel lda ShadScrn jsr getdown sta ShadScrn cmp #3 bne ]RemoveGd
    * Skel lands on scrn 3
     lda #Splat jsr addsound lda #$85 sta ShadX lda #1 sta ShadBlockY lda #0 sta ShadFace lda #-1 sta ShadLife jmp updateguard
    *-------------------------------**  C U T   C H A R**  Is character passing o.s.?  If so, cut with him to next scrn**  Change CharX,Y,BlockY,Scrn to reflect posn on new scrn**  Return A = direction of cut, -1 if no cut**-------------------------------cutchar lda CharY
     ldx CharAction cpx #5 beq :notup cpx #4 beq :notup ;In freefall--cut only down cpx #3 beq :notup
    *  Cut up/down?
     cmp #TopCutEdgePl bcc :CUTUP
     cmp #TopCutEdgeMi bcs :CUTUP:notup cmp #BotCutEdge bcs :CUTDOWN
    *  Cut left/right?
     ldx CharPosn cpx #135 bcc :nocu cpx #150 bcc :nocut ;don't cut L/R on climbup:nocu cpx #110 bcc :nosu cpx #120 bcc :nocut ;or on standup:nosu cpx #150 bcc :nost cpx #163 bcc :nocut cpx #166 bcc :nost cpx #169 bcc :nocut ;or on strike/block:nost lda CharAction cmp #7 beq :nocut ;or on turning
     ldx CharFace ;-1=left, 0=right beq :faceR;facing left lda leftej cmp #LeftCutEdge bcc :CUTLEFT beq :CUTLEFT
     cmp #ScrnRight+1 bcs :CUTRIGHT bcc :nocut
    :faceR lda CharScrn ldx #9 ldy CharBlockY jsr rdblock
     cmp #panelwif beq :nocutr cmp #panelwof beq :nocutr ;don't cut R if a panel blocks view
     lda rightej cmp #RightCutEdge bcs :CUTRIGHT
    :nocutr lda rightej cmp #ScrnLeft-1 bcc :CUTLEFT beq :CUTLEFT
    :nocut lda #-1 rts
    :CUTLEFT jsr mirrmusic jsr milestone3 lda #0 bpl :cut
    :CUTRIGHT jsr stealsword jsr jaffmusic lda #1 bpl :cut
    :CUTUP lda #2 bpl :cut
    * Level 6 ("Plunge"): Kid falls off screen 1 into next level
    :CUTDOWN jsr infinity
     lda level cmp #6 bne :no6 lda CharScrn cmp #1 beq :nocut:no6 lda #3:cut pha jsr cut pla]rts rts
    *-------------------------------* Level 12--fall off into infinity*-------------------------------infinity rts
    *-------------------------------* Passed Level 3 milestone?*-------------------------------milestone3 lda level cmp #3 bne ]rts lda #7 ;scrn to R of gate]mcheck cmp CharScrn bne ]rts lda #1 sta milestone lda MaxKidStr sta origstrength rts
    *-------------------------------* Level 12: Shadow steals sword*-------------------------------stealsword lda level cmp #12 bne ]rts lda CharScrn cmp #18 ;scrn below swordscrn bne ]rts lda #swordscrn ldx #swordx ldy #swordy jsr rdblock lda #floor sta (BlueType),y rts
    *-------------------------------* Level 13: Play Jaffar's Theme*-------------------------------jaffmusic lda level cmp #13 bne ]rts lda exitopen bne ]rts lda CharScrn cmp #3 bne ]rts lda #s_Jaffar ldx #25 jmp cuesong
    *-------------------------------* Level 4 ("Mirror"): Play danger theme for mirror*-------------------------------mirrmusic lda exitopen beq :no4 cmp #77 beq :no4 lda level cmp #4 bne :no4 lda CharBlockY cmp #miry bne :no4 lda CharScrn cmp #11 ;scrn to R of mirscrn bne :no4 lda #s_Danger ldx #50 jsr cuesong lda #77 sta exitopen ;so we don't repeat theme:no4]rts rts
    *-------------------------------**  C U T**  Move char from CharScrn to adjacent screen**  In: A = cut dir: 0 = left, 1 = right, 2 = up, 3 = down**-------------------------------CUT cmp #3 beq Cdown cmp #1 beq Cright cmp #2 beq Cup
    Cleft lda CharScrn jsr getleft ;get new screen # sta CharScrn
     lda #140 clc adc CharX sta CharX
     ldx #1 ;new FromDir rts
    Cright lda CharScrn jsr getright sta CharScrn
     lda CharX sec sbc #140 sta CharX
     ldx #0 rts
    Cup lda CharScrn jsr getup sta CharScrn
     lda CharBlockY clc adc #3 sta CharBlockY
     lda CharY clc adc #189 sta CharY
     ldx #3 rts
    Cdown lda CharScrn jsr getdown sta CharScrn
     lda CharBlockY sec sbc #3 sta CharBlockY
     lda CharY sec sbc #189 sta CharY
     ldx #2]rts rts
    *-------------------------------** A D D  G U A R D** On cut to new screen--if guard is there, bring him to life* Also handles hard-wired shadowman appearances** In: VisScrn**-------------------------------ADDGUARD lda #0 sta offguard
    * Level 12
     lda level cmp #12 bne :not12 lda exitopen ;set when shadow drops bne ]rts lda mergetimer bne :1 ;shadow has been reabsorbed lda VisScrn cmp #swordscrn:1 bne ]rts sta CharScrn
     ldx #swordx ldy #swordy jsr rdblock cmp #sword beq ]rts ;sword is still there lda #0 sta shadowaction lda #1 sta exitopen lda #shadpos12 ldx #>shadpos12 jmp csps
    * Level 6 (Plunge)
    :not12 lda level cmp #6 ;plunge bne :not6
     lda VisScrn sta CharScrn cmp #1 bne AddNormalGd
     lda exitopen cmp #77 beq :norepeat lda #s_Danger ldx #50 jsr cuesong lda #77 sta exitopen:norepeat lda #shadpos6a ldx #>shadpos6a jmp csps
    * Level 5 (Thief)
    :not6 lda level cmp #5 ;thief bne :not5
     lda VisScrn sta CharScrn cmp #flaskscrn bne AddNormalGd
     ldx #flaskx ldy #flasky jsr rdblock cmp #flask bne ]rts ;potion is gone
     lda #shadpos5 ldx #>shadpos5 jmp csps]rts rts:not5
    *-------------------------------AddNormalGd ldx VisScrn lda GdStartBlock-1,x cmp #30 bcs ]rts ;no guard on this scrn
    * Bring guard to life (or death)
     stx CharScrn
     jsr unindex ;return A = blockx, X = blocky stx CharBlockY
     lda FloorY+1,x sta CharY
     ldx VisScrn lda GdStartX-1,x sta CharX jsr getblockxp sta CharBlockX
     ldx VisScrn lda GdStartFace-1,x sta CharFace
     lda level cmp #3 bne :3
     lda #4 ;skel bne :4:3 lda #2 ;guard:4 sta CharID
     lda GdStartSeqH-1,x bne :1 ;0 is code for fresh start
     lda CharID cmp #4 bne :5 lda #2 sta CharSword lda #landengarde ;skel (ready) bne :6:5 lda #0 sta CharSword lda #alertstand ;guard:6 jsr jumpseq jmp :2
    :1 sta CharSeq+1 lda GdStartSeqL-1,x sta CharSeq
    :2 jsr animchar
     lda CharPosn cmp #185 ;killed beq :dead cmp #177 ;impaled beq :dead cmp #178 ;halved beq :dead
    * Live guard
     lda #-1 sta CharLife
     lda #0 sta alertguard sta refract sta justblocked
     jsr getgdstrength jmp :cont
    * Dead guard
    :dead lda #1 sta CharLife lda #0 sta OppStrength
    * Continue
    :cont lda #0 sta CharXVel sta CharYVel lda #1 sta CharAction
     ldx VisScrn lda GdStartProg-1,x cmp #numprogs bcc :ok lda #3 ;default:ok sta guardprog
     ldx level lda basiccolor,x ldx guardprog eor specialcolor,x ;0 = normal, 1 = special sta GuardColor  ;0 = blue, 1 = red
     jmp SaveShad ;save ShadVars
    *-------------------------------* Get guard fighting strength*-------------------------------getgdstrength ldx level lda basicstrength,x ldx guardprog clc adc extrastrength,x sta MaxOppStr sta OppStrength]rts rts
    *------------------------------- lst ds 1 usr $a9,17,$800,*-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