_startAddress_ EQU 0x0200 ; Internal Variables serialRawPrev EQU 0x0081 register0 EQU 0x0082 register1 EQU register0 + 0x02 register2 EQU register0 + 0x04 register3 EQU register0 + 0x06 register4 EQU register0 + 0x08 register5 EQU register0 + 0x0A register6 EQU register0 + 0x0C register7 EQU register0 + 0x0E register8 EQU register0 + 0x10 register9 EQU register0 + 0x12 register10 EQU register0 + 0x14 register11 EQU register0 + 0x16 register12 EQU register0 + 0x18 register13 EQU register0 + 0x1A register14 EQU register0 + 0x1C register15 EQU register0 + 0x1E fgbgColour EQU register0 + 0x20 cursorXY EQU register0 + 0x22 midiStream EQU register0 + 0x24 midiDelay EQU register0 + 0x26 miscFlags EQU register0 + 0x28 timerTick EQU register0 + 0x2A timerPrev EQU register0 + 0x2C ; Internal Constants ENABLE_SCROLL_BIT EQU 0x0001 ON_BOTTOM_ROW_BIT EQU 0x0002 ENABLE_SCROLL_MSK EQU 0xfffe ON_BOTTOM_ROW_MSK EQU 0xfffd ; Internal Buffers regsWorkArea EQU 0x0000 textWorkArea EQU 0x7fa0 ; Includes %includePath "../../at67/gbas/runtime" %include util.i %include gigatron.i %include macros.i ; Labels _entryPoint_ EQU 0x0200 _loop EQU 0x02ce _handleInput EQU 0x02eb _gameOverInput EQU 0x04d4 _displayGameOver EQU 0x050d _playSndCardFlip EQU 0x0539 _playSndHold EQU 0x057f _playSndUnHold EQU 0x05c5 _playSndBet EQU 0x0616 _playSndWin EQU 0x063b _getRomNote EQU 0x06b2 _initCards EQU 0x06c8 _clearHand EQU 0x08e0 _dealCards EQU 0x09f6 _retry1 EQU 0x0aa6 _cheatDeal EQU 0x0af5 _drawCards EQU 0x0caa _retry2 EQU 0x0cc7 _selectCard EQU 0x0dc7 _holdCard EQU 0x10f5 _displayPayouts EQU 0x13ea _displayBalance EQU 0x19a9 _updateBalance EQU 0x1cce _displayBet EQU 0x1eae _displayCardBacks EQU 0x1ef0 _displayCards EQU 0x21cc _sortCards EQU 0x3dbb _checkHand EQU 0x3ee6 _jacksOrBetter EQU 0x43d4 _twoPair EQU 0x44d6 _threeOfAKind EQU 0x45e1 _straight EQU 0x47a4 _flush EQU 0x48da _fullHouse EQU 0x4ac2 _fourOfAKind EQU 0x4bc0 _straightFlush EQU 0x4cbe _royalFlush EQU 0x4cdd _else_0x02e6 EQU 0x02e4 _endif_0x02eb EQU 0x02e9 _page_0x0300 EQU 0x0300 _endif_0x0330 EQU 0x032e _endif_0x033e EQU 0x033c _endif_0x037b EQU 0x036b _endif_0x0389 EQU 0x0379 _endif_0x03c5 EQU 0x03a7 _endif_0x03d8 EQU 0x03ba _endif_0x0414 EQU 0x03e8 _page_0x0400 EQU 0x0400 _endif_0x0427 EQU 0x040b _else_0x0473 EQU 0x044f _endif_0x049e EQU 0x0476 _endif_0x04ba EQU 0x048a _endif_0x04d3 EQU 0x04a3 _endif_0x04dc EQU 0x04ac _endif_0x050a EQU 0x04d2 _page_0x0500 EQU 0x0500 _endif_0x053a EQU 0x050b _page_0x0600 EQU 0x0600 _next_0x0701 EQU 0x06d1 _page_0x08a0 EQU 0x08a0 _endif_0x077e EQU 0x08d0 _next_0x0793 EQU 0x08e5 _page_0x09a0 EQU 0x09a0 _page_0x0aa0 EQU 0x0aa0 _else_0x0853 EQU 0x0adc _endif_0x0858 EQU 0x0ae1 _page_0x0ba0 EQU 0x0ba0 _page_0x0ca0 EQU 0x0ca0 _next_0x08f9 EQU 0x0caf _page_0x0da0 EQU 0x0da0 _else_0x098a EQU 0x0db2 _endif_0x098f EQU 0x0db7 _page_0x0ea0 EQU 0x0ea0 _page_0x0fa0 EQU 0x0fa0 _elseif_0x0a3b EQU 0x0fb4 _elseif_0x0a65 EQU 0x0fda _page_0x10a0 EQU 0x10a0 _elseif_0x0a8f EQU 0x10ac _elseif_0x0ab9 EQU 0x10d2 _endif_0x0ade EQU 0x10f3 _page_0x11a0 EQU 0x11a0 _elseif_0x0b02 EQU 0x11bd _elseif_0x0b1b EQU 0x11d2 _elseif_0x0b34 EQU 0x11e7 _page_0x12a0 EQU 0x12a0 _elseif_0x0b4d EQU 0x12a7 _endif_0x0b61 EQU 0x12b7 _page_0x13a0 EQU 0x13a0 _elseif_0x0bc4 EQU 0x13ac _endif_0x0c14 EQU 0x13e8 _page_0x14a0 EQU 0x14a0 _endif_0x0c33 EQU 0x14ae _endif_0x0c67 EQU 0x14de _page_0x15a0 EQU 0x15a0 _endif_0x0c9b EQU 0x15bb _endif_0x0ccf EQU 0x15eb _page_0x16a0 EQU 0x16a0 _endif_0x0d03 EQU 0x16c5 _endif_0x0d37 EQU 0x16f5 _page_0x17a0 EQU 0x17a0 _endif_0x0d6b EQU 0x17d0 _page_0x18a0 EQU 0x18a0 _endif_0x0d9f EQU 0x18ae _endif_0x0dd3 EQU 0x18de _page_0x19a0 EQU 0x19a0 _page_0x1aa0 EQU 0x1aa0 _elseif_0x0e46 EQU 0x1aa4 _elseif_0x0e92 EQU 0x1aec _page_0x1ba0 EQU 0x1ba0 _else_0x0edf EQU 0x1be6 _page_0x1ca0 EQU 0x1ca0 _endif_0x0f16 EQU 0x1ccc _page_0x1da0 EQU 0x1da0 _endif_0x0f86 EQU 0x1dda _endif_0x0f94 EQU 0x1de8 _page_0x1ea0 EQU 0x1ea0 _endif_0x0fb2 EQU 0x1eac _page_0x1fa0 EQU 0x1fa0 _page_0x20a0 EQU 0x20a0 _page_0x21a0 EQU 0x21a0 _page_0x22a0 EQU 0x22a0 _endif_0x1140 EQU 0x22d4 _page_0x23a0 EQU 0x23a0 _else_0x11b4 EQU 0x23dc _endif_0x11b8 EQU 0x23e0 _page_0x24a0 EQU 0x24a0 _elseif_0x11fb EQU 0x24c1 _page_0x25a0 EQU 0x25a0 _elseif_0x123e EQU 0x25a2 _elseif_0x1281 EQU 0x25d9 _page_0x26a0 EQU 0x26a0 _else_0x12c4 EQU 0x26bb _endif_0x12f1 EQU 0x26e0 _page_0x27a0 EQU 0x27a0 _endif_0x1316 EQU 0x27a7 _page_0x28a0 EQU 0x28a0 _endif_0x137a EQU 0x28a7 _page_0x29a0 EQU 0x29a0 _else_0x13ee EQU 0x29b3 _endif_0x13f2 EQU 0x29b7 _elseif_0x1435 EQU 0x29ee _page_0x2aa0 EQU 0x2aa0 _elseif_0x1478 EQU 0x2ad0 _page_0x2ba0 EQU 0x2ba0 _elseif_0x14bb EQU 0x2bb6 _else_0x14fe EQU 0x2bed _page_0x2ca0 EQU 0x2ca0 _endif_0x152b EQU 0x2cbf _endif_0x1550 EQU 0x2cdc _page_0x2da0 EQU 0x2da0 _endif_0x15b4 EQU 0x2ddc _page_0x2ea0 EQU 0x2ea0 _else_0x1628 EQU 0x2ee2 _endif_0x162c EQU 0x2ee6 _page_0x2fa0 EQU 0x2fa0 _elseif_0x166f EQU 0x2fcb _page_0x30a0 EQU 0x30a0 _elseif_0x16b2 EQU 0x30ac _elseif_0x16f5 EQU 0x30e3 _page_0x31a0 EQU 0x31a0 _else_0x1738 EQU 0x31cb _endif_0x1765 EQU 0x31f0 _page_0x32a0 EQU 0x32a0 _endif_0x178a EQU 0x32b9 _page_0x33a0 EQU 0x33a0 _endif_0x17ee EQU 0x33b7 _page_0x34a0 EQU 0x34a0 _else_0x1862 EQU 0x34bf _endif_0x1866 EQU 0x34c3 _page_0x35a0 EQU 0x35a0 _elseif_0x18a9 EQU 0x35a4 _elseif_0x18ec EQU 0x35db _page_0x36a0 EQU 0x36a0 _elseif_0x192f EQU 0x36bd _else_0x1972 EQU 0x36f4 _page_0x37a0 EQU 0x37a0 _endif_0x199f EQU 0x37c3 _endif_0x19c4 EQU 0x37e0 _page_0x38a0 EQU 0x38a0 _endif_0x1a28 EQU 0x38de _page_0x39a0 EQU 0x39a0 _else_0x1a9c EQU 0x39e4 _endif_0x1aa0 EQU 0x39e8 _page_0x3aa0 EQU 0x3aa0 _elseif_0x1ae3 EQU 0x3acb _page_0x3ba0 EQU 0x3ba0 _elseif_0x1b26 EQU 0x3bac _elseif_0x1b69 EQU 0x3be3 _page_0x3ca0 EQU 0x3ca0 _else_0x1bac EQU 0x3ccb _endif_0x1bd9 EQU 0x3cf0 _page_0x3da0 EQU 0x3da0 _endif_0x1bfe EQU 0x3db9 _next_0x1c05 EQU 0x3dc0 _next_0x1c15 EQU 0x3dcc _page_0x3ea0 EQU 0x3ea0 _endif_0x1c97 EQU 0x3ec8 _page_0x3fa0 EQU 0x3fa0 _page_0x40a0 EQU 0x40a0 _endif_0x1d65 EQU 0x40c9 _endif_0x1d8d EQU 0x40eb _page_0x41a0 EQU 0x41a0 _endif_0x1db5 EQU 0x41bb _endif_0x1ddd EQU 0x41dd _page_0x42a0 EQU 0x42a0 _endif_0x1e04 EQU 0x42a8 _endif_0x1e2b EQU 0x42c9 _endif_0x1e53 EQU 0x42eb _page_0x43a0 EQU 0x43a0 _endif_0x1e7b EQU 0x43bb _endif_0x1e96 EQU 0x43d2 _next_0x1e9d EQU 0x43d9 _page_0x44a0 EQU 0x44a0 _endif_0x1f07 EQU 0x44c6 _page_0x45a0 EQU 0x45a0 _elseif_0x1f41 EQU 0x45a2 _elseif_0x1f6a EQU 0x45c3 _endif_0x1f8e EQU 0x45df _next_0x1f95 EQU 0x45e6 _page_0x46a0 EQU 0x46a0 _endif_0x201f EQU 0x46e9 _page_0x47a0 EQU 0x47a0 _elseif_0x209f EQU 0x47f4 _page_0x48a0 EQU 0x48a0 _endif_0x20ed EQU 0x48d8 _page_0x49a0 EQU 0x49a0 _page_0x4aa0 EQU 0x4aa0 _endif_0x21c0 EQU 0x4ac0 _elseif_0x21fa EQU 0x4aee _page_0x4ba0 EQU 0x4ba0 _endif_0x222c EQU 0x4bbe _elseif_0x2266 EQU 0x4bec _page_0x4ca0 EQU 0x4ca0 _endif_0x2298 EQU 0x4cbc _endif_0x22bf EQU 0x4cdb _page_0x4da0 EQU 0x4da0 _endif_0x231e EQU 0x4dcc ; Global Variables _balance EQU 0x0030 _betAmount EQU 0x0032 _winAmount EQU 0x0034 _currentRound EQU 0x0036 _selectedCard EQU 0x0038 _pickedCard EQU 0x003a _tempCard EQU 0x003c _tempValue1 EQU 0x003e _tempValue2 EQU 0x0040 _tempValue3 EQU 0x0042 _straightFlag EQU 0x0044 _flushFlag EQU 0x0046 _winType EQU 0x0048 _holdX EQU 0x004a _inputDevice EQU 0x004c _note EQU 0x004e _notes EQU 0x0050 _index EQU 0x0052 _suit EQU 0x0054 _i EQU 0x0056 _j EQU 0x0058 _card0 EQU 0x005a _card1 EQU 0x005c _card2 EQU 0x005e _card3 EQU 0x0060 _card4 EQU 0x0062 ; Local Variables ; Arrays _cardValue_array EQU 0x71cb _cardValue_array DB 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 _cardSuit_array EQU 0x70cb _cardSuit_array DB 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 _cardState_array EQU 0x6fcb _cardState_array DB 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 _hand_array EQU 0x71c5 _hand_array DB 0x00 0x00 0x00 0x00 0x00 0x00 ; Strings ; Constant Strings _str_0x71af EQU 0x71af _str_0x71af DB 20 'Game Over. Press (A)' 0 _str_0x70b0 EQU 0x70b0 _str_0x70b0 DB 25 ' ' 0 _str_0x71a4 EQU 0x71a4 _str_0x71a4 DB 9 ' ' 0 _str_0x70aa EQU 0x70aa _str_0x70aa DB 4 'HELD' 0 _str_0x70a4 EQU 0x70a4 _str_0x70a4 DB 4 ' ' 0 _str_0x6fb9 EQU 0x6fb9 _str_0x6fb9 DB 16 'Royal Flush x250' 0 _str_0x6fab EQU 0x6fab _str_0x6fab DB 12 'S.Flush x50' 0 _str_0x6ef2 EQU 0x6ef2 _str_0x6ef2 DB 12 '4-Kind x25' 0 _str_0x6ee5 EQU 0x6ee5 _str_0x6ee5 DB 11 'F.House x9' 0 _str_0x6ed8 EQU 0x6ed8 _str_0x6ed8 DB 11 'Flush x6' 0 _str_0x6ecb EQU 0x6ecb _str_0x6ecb DB 11 'Straight x4' 0 _str_0x6ebe EQU 0x6ebe _str_0x6ebe DB 11 '3-Kind x3' 0 _str_0x6eb1 EQU 0x6eb1 _str_0x6eb1 DB 11 'Two Pair x2' 0 _str_0x6ea4 EQU 0x6ea4 _str_0x6ea4 DB 11 'Jacks+ x1' 0 _str_0x6fa2 EQU 0x6fa2 _str_0x6fa2 DB 7 'Bal:000' 0 _str_0x6df8 EQU 0x6df8 _str_0x6df8 DB 6 'Bal:00' 0 _str_0x6df1 EQU 0x6df1 _str_0x6df1 DB 5 'Bal:0' 0 _str_0x6deb EQU 0x6deb _str_0x6deb DB 4 'Bal:' 0 _str_0x6de5 EQU 0x6de5 _str_0x6de5 DB 4 'Win:' 0 _str_0x6ddf EQU 0x6ddf _str_0x6ddf DB 4 'Bet:' 0 _str_0x7da2 EQU 0x7da2 _str_0x7da2 DB 1 'A' 0 _str_0x7ca2 EQU 0x7ca2 _str_0x7ca2 DB 1 'K' 0 _str_0x7ba2 EQU 0x7ba2 _str_0x7ba2 DB 1 'Q' 0 _str_0x7aa2 EQU 0x7aa2 _str_0x7aa2 DB 1 'J' 0 ; Data ; Time ; Define Bytes ; Define Words ; Define Images ; Define Loader Image Chunks ; Define Sprites def_sprites_0x7da5 EQU 0x7da5 def_sprites_0x7da5 DB 63 63 63 63 63 0 63 63 63 63 0 0 63 63 63 63 0 0 63 63 63 63 0 0 63 0 0 0 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 63 0 63 0 0 0 63 0 63 63 63 63 63 0 63 63 63 63 0 0 63 63 0 0 0 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x7ca5 EQU 0x7ca5 def_sprites_0x7ca5 DB 0 63 63 63 63 63 0 0 63 63 63 63 0 0 63 63 63 63 0 0 63 63 63 63 0 63 0 0 0 63 0 0 0 0 0 0 0 0 0 0 0 0 0 63 0 0 0 0 0 63 0 0 0 63 0 63 63 63 63 63 0 0 63 63 63 63 0 0 0 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x7ba5 EQU 0x7ba5 def_sprites_0x7ba5 DB 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x7aa5 EQU 0x7aa5 def_sprites_0x7aa5 DB 63 63 63 63 63 63 63 63 63 63 63 0 63 63 63 63 0 3 63 63 63 0 3 63 63 63 0 3 63 3 63 0 3 3 3 3 0 3 3 3 3 3 63 0 3 3 3 3 63 63 0 3 3 3 63 63 63 0 3 3 63 63 63 63 0 3 63 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x79a5 EQU 0x79a5 def_sprites_0x79a5 DB 0 63 63 63 63 63 3 0 63 63 63 63 3 3 0 63 63 63 3 3 3 0 63 63 3 3 3 3 0 63 3 3 3 3 3 0 3 3 3 3 3 3 3 3 3 3 3 0 3 3 3 3 0 63 3 3 3 0 63 63 3 3 0 63 63 63 3 0 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x78a5 EQU 0x78a5 def_sprites_0x78a5 DB 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x77a5 EQU 0x77a5 def_sprites_0x77a5 DB 63 63 0 0 0 63 63 0 3 3 3 0 0 3 63 63 3 3 0 3 63 3 3 3 0 3 3 3 3 3 0 3 3 3 3 3 63 0 3 3 3 3 63 63 0 3 3 3 63 63 63 0 3 3 63 63 63 63 0 3 63 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x76a5 EQU 0x76a5 def_sprites_0x76a5 DB 63 63 0 0 0 63 63 0 3 3 3 0 0 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 0 3 3 3 3 0 63 3 3 3 0 63 63 3 3 0 63 63 63 3 0 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x75a5 EQU 0x75a5 def_sprites_0x75a5 DB 63 63 63 63 63 63 63 63 63 63 63 63 0 63 63 63 63 63 0 63 63 63 63 63 0 63 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x74a5 EQU 0x74a5 def_sprites_0x74a5 DB 63 63 63 63 63 63 63 63 63 63 63 0 63 63 63 63 0 0 63 63 63 0 0 0 63 63 0 0 0 0 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 63 63 0 0 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 0 63 63 63 63 0 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x73a5 EQU 0x73a5 def_sprites_0x73a5 DB 0 63 63 63 63 63 0 0 63 63 63 63 0 0 0 63 63 63 0 0 0 0 63 63 0 0 0 0 0 63 0 0 0 0 0 0 0 0 0 0 0 0 0 63 63 0 0 0 0 63 63 63 0 0 0 63 63 63 63 63 0 0 63 63 63 63 0 0 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 def_sprites_0x72a5 EQU 0x72a5 def_sprites_0x72a5 DB 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 0 63 63 63 63 63 0 63 63 63 63 63 0 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 241 ; Define Fonts ; Lookup Tables _spriteLut_0x6dd1 EQU 0x6dd1 _spriteLut_0x6dd1 DW 0x7da5 0x0000 0x7ca5 0x0006 0x7ba5 0x000c 0x0000 _spriteLut_0x6dc3 EQU 0x6dc3 _spriteLut_0x6dc3 DW 0x7aa5 0x0000 0x79a5 0x0006 0x78a5 0x000c 0x0000 _spriteLut_0x6db5 EQU 0x6db5 _spriteLut_0x6db5 DW 0x77a5 0x0000 0x76a5 0x0006 0x75a5 0x000c 0x0000 _spriteLut_0x6da7 EQU 0x6da7 _spriteLut_0x6da7 DW 0x74a5 0x0000 0x73a5 0x0006 0x72a5 0x000c 0x0000 _spritesLut_ EQU 0x6cf8 _spritesLut_ DW 0x6dd1 0x6dc3 0x6db5 0x6da7 ; Code _entryPoint_ LDI 0x28 STW romType RomCheck Initialise InitEqOp InitGtOp ; Main: INIT ClearVertBlinds LDI 2 STW graphicsMode ScanlineMode ; Main: cls : mode 2 LD 0x21 ORI 3 ST 33 ; Main: poke &h21, peek(&h21) OR 3 SoundAllOff ; Main: sound off ClearVertBlinds ; Main: cls LDI 25 STW _balance ; Main: balance = 25 LDI 1 STW _betAmount ; Main: betAmount = 1 LDI 0 STW _winAmount ; Main: winAmount = 0 LDI 2 STW _currentRound ; Main: currentRound = DRAW LDI 0 STW _selectedCard ; Main: selectedCard = 0 LDI 0 STW _pickedCard ; Main: pickedCard = 0 LDI 0 STW _tempCard ; Main: tempCard = 0 LDI 0 STW _tempValue1 ; Main: tempValue1 = 0 LDI 0 STW _tempValue2 ; Main: tempValue2 = 0 LDI 0 STW _tempValue3 ; Main: tempValue3 = 0 LDI 0 STW _straightFlag ; Main: straightFlag = 0 LDI 0 STW _flushFlag ; Main: flushFlag = 0 LDI 0 STW _winType ; Main: winType = NONE LDI 0 STW _holdX ; Main: holdX = 0 LDI 255 STW _inputDevice ; Main: inputDevice = 255 LDWI _initCards CALL giga_vAC ; Main: gosub initCards LDI 16 ST fgbgColour ; Main: set BG_COLOUR, 16 LDI 16 ST fgbgColour + 1 ; Main: set FG_COLOUR, 16 LDI 3 STW drawRectF_x1 LDI 0 STW drawRectF_y1 LDI 156 STW drawRectF_x2 LDI 47 STW drawRectF_y2 DrawRectF ; Main: rectf 3, 0, 156, 47 LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 3 STW drawRect_x1 LDI 0 STW drawRect_y1 LDI 156 STW drawRect_x2 LDI 47 STW drawRect_y2 DrawRect ; Main: rect 3, 0, 156, 47 LDWI _displayPayouts CALL giga_vAC ; Main: gosub displayPayouts LDWI _displayCardBacks CALL giga_vAC ; Main: gosub displayCardBacks LDWI _displayBalance CALL giga_vAC ; Main: gosub displayBalance LDWI _displayBet CALL giga_vAC ; Main: gosub displayBet _loop LDW _currentRound XORI 0 JumpEQ _else_0x02e6 0 ; Main: if currentRound &= GAMEOVER LDWI _gameOverInput CALL giga_vAC LDWI _endif_0x02eb CALL giga_vAC ; Main: gosub gameOverInput _else_0x02e6 LDWI _handleInput CALL giga_vAC ; Main: gosub handleInput _endif_0x02eb BRA _loop ; Main: goto &loop _handleInput PUSH LD giga_buttonState STW _inputDevice ; Main: inputDevice = get("BUTTON_STATE") LDW _inputDevice STLW 0xFE LDWI _page_0x0300 CALL giga_vAC _page_0x0300 LDLW 0xFE XORI 254 CALL convertEqOpAddr STW 0xe8 LDW _currentRound XORI 1 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x033e 3 ; Main: if (inputDevice = 254) AND (currentRound = DEAL) LDW _selectedCard ADDI 1 STW _selectedCard ; Main: selectedCard = selectedCard + 1 LDW _selectedCard XORI 5 JumpEQ _endif_0x0330 2 ; Main: if selectedCard &= 5 LDI 0 STW _selectedCard ; Main: selectedCard = 0 _endif_0x0330 LDWI _selectCard CALL giga_vAC ; Main: gosub selectCard LDI 10 STW waitVBlankNum WaitVBlanks ; Main: wait 10 _endif_0x033e LDW _inputDevice XORI 253 CALL convertEqOpAddr STW 0xe8 LDW _currentRound XORI 1 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x0389 5 ; Main: if (inputDevice = 253) AND (currentRound = DEAL) LDW _selectedCard SUBI 1 STW _selectedCard ; Main: selectedCard = selectedCard - 1 LDWI -1 XORW _selectedCard JumpEQ _endif_0x037b 4 ; Main: if selectedCard &= -1 LDI 4 STW _selectedCard ; Main: selectedCard = 4 _endif_0x037b LDWI _selectCard CALL giga_vAC ; Main: gosub selectCard LDI 10 STW waitVBlankNum WaitVBlanks ; Main: wait 10 _endif_0x0389 LDW _inputDevice XORI 247 CALL convertEqOpAddr STW 0xe8 LDW _currentRound XORI 2 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x03d8 7 ; Main: if (inputDevice = 247) AND (currentRound = DRAW) LDW _betAmount ADDI 1 STW _betAmount ; Main: betAmount = betAmount + 1 LDW _betAmount SUBI 5 JumpGT _endif_0x03c5 6 ; Main: if betAmount &> 5 LDI 1 STW _betAmount ; Main: betAmount = 1 _endif_0x03c5 LDWI _displayBet CALL giga_vAC ; Main: gosub displayBet LDWI _playSndBet CALL giga_vAC ; Main: gosub playSndBet LDI 10 STW waitVBlankNum WaitVBlanks ; Main: wait 10 _endif_0x03d8 LDW _inputDevice XORI 251 CALL convertEqOpAddr STW 0xe8 LDW _currentRound XORI 2 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x0427 9 ; Main: if (inputDevice = 251) AND (currentRound = DRAW) LDW _betAmount SUBI 1 STW _betAmount ; Main: betAmount = betAmount - 1 LDW _betAmount SUBI 1 JumpLT _endif_0x0414 8 ; Main: if betAmount &< 1 LDI 5 STW _betAmount ; Main: betAmount = 5 _endif_0x0414 LDWI _displayBet CALL giga_vAC ; Main: gosub displayBet LDWI _playSndBet CALL giga_vAC ; Main: gosub playSndBet STLW 0xFE LDWI _page_0x0400 CALL giga_vAC _page_0x0400 LDLW 0xFE LDI 10 STW waitVBlankNum WaitVBlanks ; Main: wait 10 _endif_0x0427 LDW _inputDevice XORI 191 JumpEQ _endif_0x04dc 14 ; Main: if inputDevice &= 191 LDW _currentRound XORI 1 JumpEQ _else_0x0473 10 ; Main: if currentRound &= DEAL LDI 2 STW _currentRound ; Main: currentRound = DRAW LDWI -1 STW _selectedCard ; Main: selectedCard = -1 LDWI _selectCard CALL giga_vAC ; Main: gosub selectCard LDWI _drawCards CALL giga_vAC ; Main: gosub drawCards LDWI _displayCards CALL giga_vAC ; Main: gosub displayCards LDWI _checkHand CALL giga_vAC ; Main: gosub checkHand LDWI _updateBalance CALL giga_vAC ; Main: gosub updateBalance LDWI _displayPayouts CALL giga_vAC LDWI _endif_0x04d3 CALL giga_vAC ; Main: gosub displayPayouts _else_0x0473 LDI 1 STW _currentRound ; Main: currentRound = DEAL LDI 0 STW _winType ; Main: winType = NONE LDWI _clearHand CALL giga_vAC ; Main: gosub clearHand LDWI _displayCardBacks CALL giga_vAC ; Main: gosub displayCardBacks LDW _betAmount SUBW _balance JumpGT _endif_0x049e 11 ; Main: if betAmount &> balance LDW _balance STW _betAmount ; Main: betAmount = balance LDWI _displayBet CALL giga_vAC ; Main: gosub displayBet _endif_0x049e LDW _balance SUBW _betAmount STW _balance ; Main: balance = balance - betAmount LDW _balance JumpLT _endif_0x04ba 12 ; Main: if balance &< 0 LDI 0 STW _balance ; Main: balance = 0 _endif_0x04ba LDWI _displayBalance CALL giga_vAC ; Main: gosub displayBalance LDWI _displayPayouts CALL giga_vAC ; Main: gosub displayPayouts LDWI _dealCards CALL giga_vAC ; Main: gosub dealCards LDWI _displayCards CALL giga_vAC ; Main: gosub displayCards LDWI _selectCard CALL giga_vAC ; Main: gosub selectCard _endif_0x04d3 LDI 10 STW waitVBlankNum WaitVBlanks ; Main: wait 10 _endif_0x04dc LDW _inputDevice XORI 127 CALL convertEqOpAddr STW 0xe8 LDW _currentRound XORI 1 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x050a 15 ; Main: if (inputDevice = 127) AND (currentRound = DEAL) LDWI _holdCard CALL giga_vAC ; Main: gosub holdCard LDI 10 STW waitVBlankNum WaitVBlanks ; Main: wait 10 _endif_0x050a Return ; Main: return _gameOverInput PUSH LD giga_buttonState STW _inputDevice ; Main: inputDevice = get("BUTTON_STATE") LDW _inputDevice XORI 127 JumpEQ _endif_0x053a 16 ; Main: if inputDevice &= 127 LDI 25 STW _balance ; Main: balance = 25 LDWI _clearHand CALL giga_vAC ; Main: gosub clearHand LDWI _displayCardBacks CALL giga_vAC ; Main: gosub displayCardBacks STLW 0xFE LDWI _page_0x0500 CALL giga_vAC _page_0x0500 LDLW 0xFE LDWI _displayBalance CALL giga_vAC ; Main: gosub displayBalance LDI 2 STW _currentRound ; Main: currentRound = DRAW _endif_0x053a Return ; Main: return _displayGameOver PUSH LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 3 ST fgbgColour ; Main: set BG_COLOUR, 3 LDI 20 ST cursorXY LDI 51 ST cursorXY + 1 AtTextCursor PrintString _str_0x71af NewLine ; Main: at 20,holdY : print "Game Over. Press (A)" LDWI _playSndUnHold CALL giga_vAC ; Main: gosub playSndUnHold Return ; Main: return _playSndCardFlip PUSH LDI 0 STW _note STW _notes ; Main: note = 0 : notes = note LDI 40 STW _index ; Main: index = 40 LDI 2 ST giga_soundTimer ; Main: set SOUND_TIMER, 2 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note LDI 2 STW waitVBlankNum WaitVBlanks ; Main: WAIT 2 LDI 45 STW _index ; Main: index = 45 LDI 2 ST giga_soundTimer ; Main: set SOUND_TIMER, 2 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note Return ; Main: return _playSndHold PUSH LDI 0 STW _note STW _notes ; Main: note = 0 : notes = note LDI 40 STW _index ; Main: index = 40 LDI 4 ST giga_soundTimer ; Main: set SOUND_TIMER, 4 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note LDI 4 STW waitVBlankNum WaitVBlanks ; Main: WAIT 4 LDI 45 STW _index ; Main: index = 45 LDI 4 ST giga_soundTimer ; Main: set SOUND_TIMER, 4 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note Return ; Main: return _playSndUnHold PUSH LDI 0 STW _note STW _notes ; Main: note = 0 : notes = note LDI 45 STW _index ; Main: index = 45 LDI 4 ST giga_soundTimer ; Main: set SOUND_TIMER, 4 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note LDI 4 STW waitVBlankNum WaitVBlanks ; Main: WAIT 4 LDI 40 STW _index ; Main: index = 40 LDI 4 ST giga_soundTimer ; Main: set SOUND_TIMER, 4 STLW 0xFE LDWI _page_0x0600 CALL giga_vAC _page_0x0600 LDLW 0xFE LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note Return ; Main: return _playSndBet PUSH LDI 0 STW _note STW _notes ; Main: note = 0 : notes = note LDW _betAmount ADDI 60 STW _index ; Main: index = betAmount + 60 LDI 5 ST giga_soundTimer ; Main: set SOUND_TIMER, 5 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note Return ; Main: return _playSndWin PUSH LDI 10 STW waitVBlankNum WaitVBlanks ; Main: WAIT 10 LDI 0 STW _note STW _notes ; Main: note = 0 : notes = note LDI 60 STW _index ; Main: index = 60 LDI 4 ST giga_soundTimer ; Main: set SOUND_TIMER, 4 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note LDI 8 STW waitVBlankNum WaitVBlanks ; Main: WAIT 8 LDI 2 ST giga_soundTimer ; Main: set SOUND_TIMER, 2 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note LDI 4 STW waitVBlankNum WaitVBlanks ; Main: WAIT 4 LDI 65 STW _index ; Main: index = 65 LDI 20 ST giga_soundTimer ; Main: set SOUND_TIMER, 20 LDWI _getRomNote CALL giga_vAC ; Main: gosub getRomNote LDI 1 ST sndChannel + 1 LDW _note STW sndFrequency SoundOn ; Main: sound on, 1, note LDI 20 STW waitVBlankNum WaitVBlanks ; Main: WAIT 20 Return ; Main: return _getRomNote PUSH ; Main: asm LDWI 0x0900 ; Main: LDWI 0x0900 ADDW _index ; Main: ADDW _index ADDW _index ; Main: ADDW _index STW _notes ; Main: STW _notes LUP 0 ; Main: LUP 0 ST _note ; Main: ST _note LDW _notes ; Main: LDW _notes LUP 1 ; Main: LUP 1 ST _note+1 ; Main: ST _note + 1 Return ; Main: return _initCards PUSH LDI 0 STW _suit ; Main: suit = 0 LDI 0 STW _i ; Main: for i = 0 to 51 _next_0x0701 LDWI 0x70cb ADDW _i STW memAddr LDW _suit POKE memAddr ; Main: cardSuit(i) = suit LDW _i STW mathX LDI 13 STW mathY LDWI divide16bit CALL giga_vAC LDW mathRem ADDI 2 STW memValue LDWI 0x71cb ADDW _i STW memAddr LDW memValue STLW 0xFE LDWI _page_0x08a0 CALL giga_vAC _page_0x08a0 LDLW 0xFE POKE memAddr ; Main: cardValue(i) = 2+(i%13) LDWI 0x6fcb ADDW _i STW memAddr LDI 0 POKE memAddr ; Main: cardState(i) = INDECK LDW _i STW mathX LDI 13 STW mathY LDWI divide16bit CALL giga_vAC LDW mathRem ADDI 2 XORI 14 JumpEQ _endif_0x077e 17 ; Main: if(2+(i%13) &= 14) LDW _suit ADDI 1 STW _suit ; Main: suit = suit + 1 _endif_0x077e ForNextFarInc _i _next_0x0701 51 ; Main: next i Return ; Main: return _clearHand PUSH LDI 0 STW _i ; Main: for i = 0 to 51 _next_0x0793 LDWI 0x6fcb ADDW _i STW memAddr LDI 0 POKE memAddr ; Main: cardState(i) = INDECK STLW 0xFE LDWI _page_0x09a0 CALL giga_vAC _page_0x09a0 LDLW 0xFE ForNextFarInc _i _next_0x0793 51 ; Main: next i LDI 32 ST fgbgColour + 1 ; Main: set FG_COLOUR, 32 LDI 32 ST fgbgColour ; Main: set BG_COLOUR, 32 LDI 0 STW _selectedCard ; Main: selectedCard = 0 LDI 7 ST cursorXY LDI 51 ST cursorXY + 1 AtTextCursor PrintString _str_0x70b0 NewLine ; Main: at 7,holdY : print " " LDI 0 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor PrintString _str_0x71a4 NewLine ; Main: at 0,110 : print " " Return ; Main: return _dealCards PUSH STLW 0xFE LDWI _page_0x0aa0 CALL giga_vAC _page_0x0aa0 LDLW 0xFE LDI 0 STW _i ; Main: for i = 0 to 4 _retry1 LDI 0x34 RandMod STW _pickedCard ; Main: pickedCard = rnd(52) LDWI 0x6fcb ADDW _pickedCard PEEK XORI 0 JumpEQ _else_0x0853 18 ; Main: if(cardState(pickedCard) &= INDECK) LDWI 0x71c5 ADDW _i STW memAddr LDW _pickedCard POKE memAddr ; Main: hand(i) = pickedCard LDWI 0x6fcb ADDW _pickedCard STW memAddr LDI 1 POKE memAddr LDWI _endif_0x0858 CALL giga_vAC ; Main: cardState(pickedCard) = DRAWN _else_0x0853 LDWI _retry1 CALL giga_vAC ; Main: goto retry1 _endif_0x0858 ForNextFarInc _i _retry1 4 ; Main: next i LDI 0 STW _selectedCard ; Main: selectedCard = 0 Return ; Main: return _cheatDeal LDWI 0x71c5 STLW 0xFE LDWI _page_0x0ba0 CALL giga_vAC _page_0x0ba0 LDLW 0xFE STW memAddr LDI 12 POKE memAddr ; Main: hand(0) = 12 LDWI 0x6fd7 STW memAddr LDI 1 POKE memAddr ; Main: cardState(12) = DRAWN LDWI 0x71c6 STW memAddr LDI 11 POKE memAddr ; Main: hand(1) = 11 LDWI 0x6fd6 STW memAddr LDI 1 POKE memAddr ; Main: cardState(11) = DRAWN LDWI 0x71c7 STW memAddr LDI 10 POKE memAddr ; Main: hand(2) = 10 LDWI 0x6fd5 STW memAddr LDI 1 POKE memAddr ; Main: cardState(10) = DRAWN LDWI 0x71c8 STW memAddr LDI 8 POKE memAddr ; Main: hand(3) = 8 LDWI 0x6fd3 STW memAddr LDI 1 POKE memAddr ; Main: cardState(8) = DRAWN LDWI 0x71c9 STW memAddr LDI 9 POKE memAddr ; Main: hand(4) = 9 LDWI 0x6fd4 STW memAddr LDI 1 STLW 0xFE LDWI _page_0x0ca0 CALL giga_vAC _page_0x0ca0 LDLW 0xFE POKE memAddr ; Main: cardState(9) = DRAWN LDI 0 STW _selectedCard ; Main: selectedCard = 0 Return ; Main: return _drawCards PUSH LDI 0 STW _i ; Main: for i = 0 to 4 _next_0x08f9 LDWI 0x71c5 ADDW _i PEEK STW _tempCard ; Main: tempCard = hand(i) LDWI 0x6fcb ADDW _tempCard PEEK XORI 1 JumpEQ _endif_0x098f 22 ; Main: if(cardState(tempCard) &= DRAWN) _retry2 LDI 0x34 RandMod STW _pickedCard ; Main: pickedCard = rnd(52) LDWI 0x6fcb ADDW _pickedCard PEEK XORI 0 JumpEQ _else_0x098a 20 ; Main: if(cardState(pickedCard) &= INDECK) LDWI 0x6fcb ADDW _tempCard STW memAddr LDI 3 POKE memAddr ; Main: cardState(tempCard) = DISCARDED LDWI 0x71c5 ADDW _i STW memAddr LDW _pickedCard POKE memAddr ; Main: hand(i) = pickedCard STLW 0xFE LDWI _page_0x0da0 CALL giga_vAC _page_0x0da0 LDLW 0xFE LDWI 0x6fcb ADDW _pickedCard STW memAddr LDI 1 POKE memAddr LDWI _endif_0x098f CALL giga_vAC ; Main: cardState(pickedCard) = DRAWN _else_0x098a LDWI _retry2 CALL giga_vAC ; Main: goto retry2 _endif_0x098f ForNextFarInc _i _next_0x08f9 4 ; Main: next i Return ; Main: return _selectCard PUSH LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 3 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 32 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect ; Main: rect 3, cardBorderY, 32, cardBorderY2 LDI 34 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 63 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect ; Main: rect 34, cardBorderY, 63, cardBorderY2 LDI 65 STLW 0xFE LDWI _page_0x0ea0 CALL giga_vAC _page_0x0ea0 LDLW 0xFE STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 94 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect ; Main: rect 65, cardBorderY, 94, cardBorderY2 LDI 96 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 125 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect ; Main: rect 96, cardBorderY, 125, cardBorderY2 LDI 127 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 156 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect ; Main: rect 127, cardBorderY, 156, cardBorderY2 LDI 3 ST fgbgColour + 1 ; Main: set FG_COLOUR, 3 LDW _selectedCard XORI 0 JumpEQ _elseif_0x0a3b 23 ; Main: if selectedCard &= 0 LDI 3 STW drawRect_x1 LDI 60 STW drawRect_y1 STLW 0xFE LDWI _page_0x0fa0 CALL giga_vAC _page_0x0fa0 LDLW 0xFE LDI 32 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect LDWI _endif_0x0ade CALL giga_vAC ; Main: rect 3, cardBorderY, 32, cardBorderY2 _elseif_0x0a3b LDW _selectedCard XORI 1 JumpEQ _elseif_0x0a65 24 ; Main: elseif selectedCard &= 1 LDI 34 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 63 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect LDWI _endif_0x0ade CALL giga_vAC ; Main: rect 34, cardBorderY, 63, cardBorderY2 _elseif_0x0a65 LDW _selectedCard XORI 2 JumpEQ _elseif_0x0a8f 25 ; Main: elseif selectedCard &= 2 LDI 65 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 94 STW drawRect_x2 LDI 107 STW drawRect_y2 STLW 0xFE LDWI _page_0x10a0 CALL giga_vAC _page_0x10a0 LDLW 0xFE DrawRect LDWI _endif_0x0ade CALL giga_vAC ; Main: rect 65, cardBorderY, 94, cardBorderY2 _elseif_0x0a8f LDW _selectedCard XORI 3 JumpEQ _elseif_0x0ab9 26 ; Main: elseif selectedCard &= 3 LDI 96 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 125 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect LDWI _endif_0x0ade CALL giga_vAC ; Main: rect 96, cardBorderY, 125, cardBorderY2 _elseif_0x0ab9 LDW _selectedCard XORI 4 JumpEQ _endif_0x0ade 27 ; Main: elseif selectedCard &= 4 LDI 127 STW drawRect_x1 LDI 60 STW drawRect_y1 LDI 156 STW drawRect_x2 LDI 107 STW drawRect_y2 DrawRect ; Main: rect 127, cardBorderY, 156, cardBorderY2 _endif_0x0ade Return ; Main: return _holdCard PUSH LDI 31 STLW 0xFE LDWI _page_0x11a0 CALL giga_vAC _page_0x11a0 LDLW 0xFE ST fgbgColour + 1 ; Main: set FG_COLOUR, 31 LDI 32 ST fgbgColour ; Main: set BG_COLOUR, 32 LDW _selectedCard XORI 0 JumpEQ _elseif_0x0b02 28 ; Main: if selectedCard &= 0 LDI 7 STW _holdX LDWI _endif_0x0b61 CALL giga_vAC ; Main: holdX = 7 _elseif_0x0b02 LDW _selectedCard XORI 1 JumpEQ _elseif_0x0b1b 29 ; Main: elseif selectedCard &= 1 LDI 38 STW _holdX LDWI _endif_0x0b61 CALL giga_vAC ; Main: holdX = 38 _elseif_0x0b1b LDW _selectedCard XORI 2 JumpEQ _elseif_0x0b34 30 ; Main: elseif selectedCard &= 2 LDI 69 STW _holdX LDWI _endif_0x0b61 CALL giga_vAC ; Main: holdX = 69 _elseif_0x0b34 LDW _selectedCard XORI 3 JumpEQ _elseif_0x0b4d 31 ; Main: elseif selectedCard &= 3 LDI 100 STW _holdX STLW 0xFE LDWI _page_0x12a0 CALL giga_vAC _page_0x12a0 LDLW 0xFE LDWI _endif_0x0b61 CALL giga_vAC ; Main: holdX = 100 _elseif_0x0b4d LDW _selectedCard XORI 4 JumpEQ _endif_0x0b61 32 ; Main: elseif selectedCard &= 4 LDI 131 STW _holdX ; Main: holdX = 131 _endif_0x0b61 LDWI 0x71c5 ADDW _selectedCard PEEK STW _tempCard ; Main: tempCard = hand(selectedCard) LDWI 0x6fcb ADDW _tempCard PEEK XORI 1 JumpEQ _elseif_0x0bc4 33 ; Main: if cardState(tempCard) &= DRAWN LDWI 0x6fcb ADDW _tempCard STW memAddr LDI 2 POKE memAddr ; Main: cardState(tempCard) = HELD LDW _holdX ST cursorXY LDI 51 ST cursorXY + 1 AtTextCursor PrintString _str_0x70aa NewLine ; Main: at holdX,holdY : print "HELD" STLW 0xFE LDWI _page_0x13a0 CALL giga_vAC _page_0x13a0 LDLW 0xFE LDWI _playSndHold CALL giga_vAC LDWI _endif_0x0c14 CALL giga_vAC ; Main: gosub playSndHold _elseif_0x0bc4 LDWI 0x6fcb ADDW _tempCard PEEK XORI 2 JumpEQ _endif_0x0c14 34 ; Main: elseif cardState(tempCard) &= HELD LDWI 0x6fcb ADDW _tempCard STW memAddr LDI 1 POKE memAddr ; Main: cardState(tempCard) = DRAWN LDW _holdX ST cursorXY LDI 51 ST cursorXY + 1 AtTextCursor PrintString _str_0x70a4 NewLine ; Main: at holdX,holdY : print " " LDWI _playSndUnHold CALL giga_vAC ; Main: gosub playSndUnHold _endif_0x0c14 Return ; Main: return _displayPayouts PUSH LDI 16 ST fgbgColour ; Main: set BG_COLOUR, 16 LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 10 STLW 0xFE LDWI _page_0x14a0 CALL giga_vAC _page_0x14a0 LDLW 0xFE JumpEQ _endif_0x0c33 35 ; Main: if winType &= ROYALFLUSH LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0c33 LDI 32 ST cursorXY LDI 2 ST cursorXY + 1 AtTextCursor PrintString _str_0x6fb9 NewLine ; Main: at 32,2 : print "Royal Flush x250" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 9 JumpEQ _endif_0x0c67 36 ; Main: if winType &= STRAIGHTFLUSH LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0c67 LDI 5 ST cursorXY LDI 11 ST cursorXY + 1 AtTextCursor PrintString _str_0x6fab STLW 0xFE LDWI _page_0x15a0 CALL giga_vAC _page_0x15a0 LDLW 0xFE NewLine ; Main: at 5,11 : print "S.Flush x50" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 7 JumpEQ _endif_0x0c9b 37 ; Main: if winType &= FOUROFAKIND LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0c9b LDI 5 ST cursorXY LDI 20 ST cursorXY + 1 AtTextCursor PrintString _str_0x6ef2 NewLine ; Main: at 5,20 : print "4-Kind x25" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 6 JumpEQ _endif_0x0ccf 38 ; Main: if winType &= FULLHOUSE LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0ccf LDI 5 ST cursorXY LDI 29 ST cursorXY + 1 AtTextCursor STLW 0xFE LDWI _page_0x16a0 CALL giga_vAC _page_0x16a0 LDLW 0xFE PrintString _str_0x6ee5 NewLine ; Main: at 5,29 : print "F.House x9" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 5 JumpEQ _endif_0x0d03 39 ; Main: if winType &= FLUSH LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0d03 LDI 5 ST cursorXY LDI 38 ST cursorXY + 1 AtTextCursor PrintString _str_0x6ed8 NewLine ; Main: at 5,38 : print "Flush x6" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 4 JumpEQ _endif_0x0d37 40 ; Main: if winType &= STRAIGHT LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0d37 LDI 90 STLW 0xFE LDWI _page_0x17a0 CALL giga_vAC _page_0x17a0 LDLW 0xFE ST cursorXY LDI 11 ST cursorXY + 1 AtTextCursor PrintString _str_0x6ecb NewLine ; Main: at 90,11 : print "Straight x4" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 3 JumpEQ _endif_0x0d6b 41 ; Main: if winType &= THREEOFAKIND LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0d6b LDI 90 ST cursorXY LDI 20 ST cursorXY + 1 AtTextCursor PrintString _str_0x6ebe NewLine ; Main: at 90,20 : print "3-Kind x3" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 2 STLW 0xFE LDWI _page_0x18a0 CALL giga_vAC _page_0x18a0 LDLW 0xFE JumpEQ _endif_0x0d9f 42 ; Main: if winType &= TWOPAIR LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0d9f LDI 90 ST cursorXY LDI 29 ST cursorXY + 1 AtTextCursor PrintString _str_0x6eb1 NewLine ; Main: at 90,29 : print "Two Pair x2" LDI 42 ST fgbgColour + 1 ; Main: set FG_COLOUR, 42 LDW _winType XORI 1 JumpEQ _endif_0x0dd3 43 ; Main: if winType &= JACKSORBETTER LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 _endif_0x0dd3 LDI 90 ST cursorXY LDI 38 ST cursorXY + 1 AtTextCursor PrintString _str_0x6ea4 STLW 0xFE LDWI _page_0x19a0 CALL giga_vAC _page_0x19a0 LDLW 0xFE NewLine ; Main: at 90,38 : print "Jacks+ x1" Return ; Main: return _displayBalance PUSH LDI 32 ST fgbgColour ; Main: set BG_COLOUR, 32 LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDW _balance SUBI 10 JumpLT _elseif_0x0e46 44 ; Main: if balance &< 10 LDI 106 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor PrintString _str_0x6fa2 NewLine ; Main: at 106,110 : print "Bal:000" LDI 148 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor LDW _balance PrintAcInt16 NewLine LDWI _endif_0x0f16 STLW 0xFE LDWI _page_0x1aa0 CALL giga_vAC _page_0x1aa0 LDLW 0xFE CALL giga_vAC ; Main: at 148,110 : print balance _elseif_0x0e46 LDW _balance SUBI 100 JumpLT _elseif_0x0e92 45 ; Main: elseif balance &< 100 LDI 106 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor PrintString _str_0x6df8 NewLine ; Main: at 106,110 : print "Bal:00" LDI 142 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor LDW _balance PrintAcInt16 NewLine LDWI _endif_0x0f16 CALL giga_vAC ; Main: at 142,110 : print balance _elseif_0x0e92 LDWI 999 SUBW _balance STLW 0xFE LDWI _page_0x1ba0 CALL giga_vAC _page_0x1ba0 LDLW 0xFE JumpGE _else_0x0edf 46 ; Main: elseif balance &< 999 LDI 106 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor PrintString _str_0x6df1 NewLine ; Main: at 106,110 : print "Bal:0" LDI 136 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor LDW _balance PrintAcInt16 NewLine LDWI _endif_0x0f16 CALL giga_vAC ; Main: at 136,110 : print balance _else_0x0edf LDI 106 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor STLW 0xFE LDWI _page_0x1ca0 CALL giga_vAC _page_0x1ca0 LDLW 0xFE PrintString _str_0x6deb NewLine ; Main: at 106,110 : print "Bal:" LDI 130 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor LDW _balance PrintAcInt16 NewLine ; Main: at 130,110 : print balance _endif_0x0f16 Return ; Main: return _updateBalance PUSH LDW _winAmount JumpGT _endif_0x0f94 49 ; Main: if winAmount &> 0 LDI 3 ST fgbgColour ; Main: set BG_COLOUR, 3 LDI 15 ST fgbgColour + 1 ; Main: set FG_COLOUR, 15 LDI 3 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor PrintString _str_0x6de5 STLW 0xFE LDWI _page_0x1da0 CALL giga_vAC _page_0x1da0 LDLW 0xFE NewLine ; Main: at 3,110 : print "Win:" LDI 26 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor LDW _winAmount PrintAcInt16 NewLine ; Main: at 26,110 : print winAmount LDW _balance ADDW _winAmount STW _balance ; Main: balance = balance + winAmount LDWI 9999 SUBW _balance JumpLE _endif_0x0f86 48 ; Main: if balance &> 9999 LDWI 9999 STW _balance ; Main: balance = 9999 _endif_0x0f86 LDI 0 STW _winAmount ; Main: winAmount = 0 LDWI _displayBalance CALL giga_vAC ; Main: gosub displayBalance LDWI _playSndWin CALL giga_vAC ; Main: gosub playSndWin _endif_0x0f94 LDW _balance SUBI 1 JumpLT _endif_0x0fb2 50 ; Main: if balance &< 1 LDI 0 STW _currentRound ; Main: currentRound = GAMEOVER STLW 0xFE LDWI _page_0x1ea0 CALL giga_vAC _page_0x1ea0 LDLW 0xFE LDWI _clearHand CALL giga_vAC ; Main: gosub clearHand LDWI _displayGameOver CALL giga_vAC ; Main: gosub displayGameOver _endif_0x0fb2 Return ; Main: return _displayBet PUSH LDI 32 ST fgbgColour ; Main: set BG_COLOUR, 32 LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 57 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor PrintString _str_0x6ddf NewLine ; Main: at 57,110 : print "Bet:" LDI 80 ST cursorXY LDI 110 ST cursorXY + 1 AtTextCursor LDW _betAmount PrintAcInt16 NewLine ; Main: at 80,110 : print betAmount Return ; Main: return _displayCardBacks PUSH LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 3 STLW 0xFE LDWI _page_0x1fa0 CALL giga_vAC _page_0x1fa0 LDLW 0xFE STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 32 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 3, cardBorderY, 32, cardBorderY2 LDI 34 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 63 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 34, cardBorderY, 63, cardBorderY2 LDI 65 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 94 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 65, cardBorderY, 94, cardBorderY2 LDI 96 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 125 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 96, cardBorderY, 125, cardBorderY2 LDI 127 STW drawRectF_x1 STLW 0xFE LDWI _page_0x20a0 CALL giga_vAC _page_0x20a0 LDLW 0xFE LDI 60 STW drawRectF_y1 LDI 156 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 127, cardBorderY, 156, cardBorderY2 LDI 21 ST fgbgColour + 1 ; Main: set FG_COLOUR, 21 LDI 4 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 31 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 4, cardY, 31, cardY2 LDI 35 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 62 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 35, cardY, 62, cardY2 LDI 66 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 93 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 66, cardY, 93, cardY2 LDI 97 STLW 0xFE LDWI _page_0x21a0 CALL giga_vAC _page_0x21a0 LDLW 0xFE STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 124 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 97, cardY, 124, cardY2 LDI 128 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 155 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 128, cardY, 155, cardY2 Return ; Main: return _displayCards PUSH LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 63 ST fgbgColour ; Main: set BG_COLOUR, 63 LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x6fcb ADDW memIndex0 PEEK XORI 1 JumpEQ _endif_0x1316 59 ; Main: if cardState(hand(0)) &= DRAWN LDW _currentRound XORI 2 JumpEQ _endif_0x1140 51 ; Main: if currentRound &= DRAW STLW 0xFE LDWI _page_0x22a0 CALL giga_vAC _page_0x22a0 LDLW 0xFE LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 3 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 32 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 3, cardBorderY, 32, cardBorderY2 LDI 21 ST fgbgColour + 1 ; Main: set FG_COLOUR, 21 LDI 4 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 31 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 4, cardY, 31, cardY2 _endif_0x1140 LDI 8 STW waitVBlankNum WaitVBlanks ; Main: WAIT 8 LDWI _playSndCardFlip CALL giga_vAC ; Main: gosub playSndCardFlip LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 4 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 31 STW drawRectF_x2 LDI 106 STW drawRectF_y2 STLW 0xFE LDWI _page_0x23a0 CALL giga_vAC _page_0x23a0 LDLW 0xFE DrawRectF ; Main: rectf 4, cardY, 31, cardY2 LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 2 CALL convertEqOpAddr STW 0xea LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 1 CALL convertEqOpAddr ORW 0xea JumpFalse _else_0x11b4 52 ; Main: if (cardSuit(hand(0)) = HEARTS) OR (cardSuit(hand(0)) = DIAMONDS) LDI 3 ST fgbgColour + 1 LDWI _endif_0x11b8 CALL giga_vAC ; Main: set FG_COLOUR, 3 _else_0x11b4 LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 _endif_0x11b8 LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 14 JumpEQ _elseif_0x11fb 54 ; Main: if cardValue(hand(0)) &= 14 LDI 7 STLW 0xFE LDWI _page_0x24a0 CALL giga_vAC _page_0x24a0 LDLW 0xFE ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7da2 NewLine LDWI _endif_0x12f1 CALL giga_vAC ; Main: at 7,cardValueY : print "A" _elseif_0x11fb LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 13 JumpEQ _elseif_0x123e 55 ; Main: elseif cardValue(hand(0)) &= 13 LDI 7 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ca2 NewLine LDWI _endif_0x12f1 CALL giga_vAC ; Main: at 7,cardValueY : print "K" STLW 0xFE LDWI _page_0x25a0 CALL giga_vAC _page_0x25a0 LDLW 0xFE _elseif_0x123e LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 12 JumpEQ _elseif_0x1281 56 ; Main: elseif cardValue(hand(0)) &= 12 LDI 7 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ba2 NewLine LDWI _endif_0x12f1 CALL giga_vAC ; Main: at 7,cardValueY : print "Q" _elseif_0x1281 LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 11 JumpEQ _else_0x12c4 57 ; Main: elseif cardValue(hand(0)) &= 11 LDI 7 ST cursorXY LDI 63 ST cursorXY + 1 STLW 0xFE LDWI _page_0x26a0 CALL giga_vAC _page_0x26a0 LDLW 0xFE AtTextCursor PrintString _str_0x7aa2 NewLine LDWI _endif_0x12f1 CALL giga_vAC ; Main: at 7,cardValueY : print "J" _else_0x12c4 LDI 7 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK PrintAcInt16 NewLine ; Main: at 7,cardValueY : print cardValue(hand(0)) _endif_0x12f1 LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW spriteId LDI 11 ST spriteXY LDI 78 ADDI 8 ST spriteXY + 1 STLW 0xFE LDWI _page_0x27a0 CALL giga_vAC _page_0x27a0 LDLW 0xFE DrawSprite ; Main: sprite noFlip, cardSuit(hand(0)), 11, cardSuitY _endif_0x1316 LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x6fcb ADDW memIndex0 PEEK XORI 1 JumpEQ _endif_0x1550 68 ; Main: if cardState(hand(1)) &= DRAWN LDW _currentRound XORI 2 JumpEQ _endif_0x137a 60 ; Main: if currentRound &= DRAW LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 34 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 63 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 34, cardBorderY, 63, cardBorderY2 LDI 21 ST fgbgColour + 1 ; Main: set FG_COLOUR, 21 LDI 35 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 62 STW drawRectF_x2 LDI 106 STW drawRectF_y2 STLW 0xFE LDWI _page_0x28a0 CALL giga_vAC _page_0x28a0 LDLW 0xFE DrawRectF ; Main: rectf 35, cardY, 62, cardY2 _endif_0x137a LDI 8 STW waitVBlankNum WaitVBlanks ; Main: WAIT 8 LDWI _playSndCardFlip CALL giga_vAC ; Main: gosub playSndCardFlip LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 35 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 62 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 35, cardY, 62, cardY2 LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 2 CALL convertEqOpAddr STW 0xea LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 1 CALL convertEqOpAddr ORW 0xea STLW 0xFE LDWI _page_0x29a0 CALL giga_vAC _page_0x29a0 LDLW 0xFE JumpFalse _else_0x13ee 61 ; Main: if (cardSuit(hand(1)) = HEARTS) OR (cardSuit(hand(1)) = DIAMONDS) LDI 3 ST fgbgColour + 1 LDWI _endif_0x13f2 CALL giga_vAC ; Main: set FG_COLOUR, 3 _else_0x13ee LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 _endif_0x13f2 LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 14 JumpEQ _elseif_0x1435 63 ; Main: if cardValue(hand(1)) &= 14 LDI 38 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7da2 NewLine LDWI _endif_0x152b CALL giga_vAC ; Main: at 38,cardValueY : print "A" _elseif_0x1435 LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x71cb STLW 0xFE LDWI _page_0x2aa0 CALL giga_vAC _page_0x2aa0 LDLW 0xFE ADDW memIndex0 PEEK XORI 13 JumpEQ _elseif_0x1478 64 ; Main: elseif cardValue(hand(1)) &= 13 LDI 38 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ca2 NewLine LDWI _endif_0x152b CALL giga_vAC ; Main: at 38,cardValueY : print "K" _elseif_0x1478 LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 12 JumpEQ _elseif_0x14bb 65 ; Main: elseif cardValue(hand(1)) &= 12 LDI 38 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor STLW 0xFE LDWI _page_0x2ba0 CALL giga_vAC _page_0x2ba0 LDLW 0xFE PrintString _str_0x7ba2 NewLine LDWI _endif_0x152b CALL giga_vAC ; Main: at 38,cardValueY : print "Q" _elseif_0x14bb LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 11 JumpEQ _else_0x14fe 66 ; Main: elseif cardValue(hand(1)) &= 11 LDI 38 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7aa2 NewLine LDWI _endif_0x152b CALL giga_vAC ; Main: at 38,cardValueY : print "J" _else_0x14fe LDI 38 ST cursorXY LDI 63 ST cursorXY + 1 STLW 0xFE LDWI _page_0x2ca0 CALL giga_vAC _page_0x2ca0 LDLW 0xFE AtTextCursor LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK PrintAcInt16 NewLine ; Main: at 38,cardValueY : print cardValue(hand(1)) _endif_0x152b LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW spriteId LDI 42 ST spriteXY LDI 78 ADDI 8 ST spriteXY + 1 DrawSprite ; Main: sprite noFlip, cardSuit(hand(1)), 42, cardSuitY _endif_0x1550 LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x6fcb ADDW memIndex0 PEEK XORI 1 JumpEQ _endif_0x178a 77 ; Main: if cardState(hand(2)) &= DRAWN LDW _currentRound XORI 2 STLW 0xFE LDWI _page_0x2da0 CALL giga_vAC _page_0x2da0 LDLW 0xFE JumpEQ _endif_0x15b4 69 ; Main: if currentRound &= DRAW LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 65 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 94 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 65, cardBorderY, 94, cardBorderY2 LDI 21 ST fgbgColour + 1 ; Main: set FG_COLOUR, 21 LDI 66 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 93 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 66, cardY, 93, cardY2 _endif_0x15b4 LDI 8 STW waitVBlankNum WaitVBlanks ; Main: WAIT 8 LDWI _playSndCardFlip CALL giga_vAC ; Main: gosub playSndCardFlip LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 66 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 93 STLW 0xFE LDWI _page_0x2ea0 CALL giga_vAC _page_0x2ea0 LDLW 0xFE STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 66, cardY, 93, cardY2 LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 2 CALL convertEqOpAddr STW 0xea LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 1 CALL convertEqOpAddr ORW 0xea JumpFalse _else_0x1628 70 ; Main: if (cardSuit(hand(2)) = HEARTS) OR (cardSuit(hand(2)) = DIAMONDS) LDI 3 ST fgbgColour + 1 LDWI _endif_0x162c CALL giga_vAC ; Main: set FG_COLOUR, 3 _else_0x1628 LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 _endif_0x162c LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 14 STLW 0xFE LDWI _page_0x2fa0 CALL giga_vAC _page_0x2fa0 LDLW 0xFE JumpEQ _elseif_0x166f 72 ; Main: if cardValue(hand(2)) &= 14 LDI 69 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7da2 NewLine LDWI _endif_0x1765 CALL giga_vAC ; Main: at 69,cardValueY : print "A" _elseif_0x166f LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 13 JumpEQ _elseif_0x16b2 73 ; Main: elseif cardValue(hand(2)) &= 13 LDI 69 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ca2 STLW 0xFE LDWI _page_0x30a0 CALL giga_vAC _page_0x30a0 LDLW 0xFE NewLine LDWI _endif_0x1765 CALL giga_vAC ; Main: at 69,cardValueY : print "K" _elseif_0x16b2 LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 12 JumpEQ _elseif_0x16f5 74 ; Main: elseif cardValue(hand(2)) &= 12 LDI 69 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ba2 NewLine LDWI _endif_0x1765 CALL giga_vAC ; Main: at 69,cardValueY : print "Q" _elseif_0x16f5 LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 11 STLW 0xFE LDWI _page_0x31a0 CALL giga_vAC _page_0x31a0 LDLW 0xFE JumpEQ _else_0x1738 75 ; Main: elseif cardValue(hand(2)) &= 11 LDI 69 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7aa2 NewLine LDWI _endif_0x1765 CALL giga_vAC ; Main: at 69,cardValueY : print "J" _else_0x1738 LDI 69 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK PrintAcInt16 NewLine ; Main: at 69,cardValueY : print cardValue(hand(2)) _endif_0x1765 LDWI 0x71c7 PEEK STW memIndex0 STLW 0xFE LDWI _page_0x32a0 CALL giga_vAC _page_0x32a0 LDLW 0xFE LDWI 0x70cb ADDW memIndex0 PEEK STW spriteId LDI 73 ST spriteXY LDI 78 ADDI 8 ST spriteXY + 1 DrawSprite ; Main: sprite noFlip, cardSuit(hand(2)), 73, cardSuitY _endif_0x178a LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x6fcb ADDW memIndex0 PEEK XORI 1 JumpEQ _endif_0x19c4 86 ; Main: if cardState(hand(3)) &= DRAWN LDW _currentRound XORI 2 JumpEQ _endif_0x17ee 78 ; Main: if currentRound &= DRAW LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 96 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 125 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 96, cardBorderY, 125, cardBorderY2 LDI 21 ST fgbgColour + 1 ; Main: set FG_COLOUR, 21 STLW 0xFE LDWI _page_0x33a0 CALL giga_vAC _page_0x33a0 LDLW 0xFE LDI 97 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 124 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 97, cardY, 124, cardY2 _endif_0x17ee LDI 8 STW waitVBlankNum WaitVBlanks ; Main: WAIT 8 LDWI _playSndCardFlip CALL giga_vAC ; Main: gosub playSndCardFlip LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 97 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 124 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 97, cardY, 124, cardY2 LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 2 CALL convertEqOpAddr STW 0xea LDWI 0x71c8 PEEK STW memIndex0 STLW 0xFE LDWI _page_0x34a0 CALL giga_vAC _page_0x34a0 LDLW 0xFE LDWI 0x70cb ADDW memIndex0 PEEK XORI 1 CALL convertEqOpAddr ORW 0xea JumpFalse _else_0x1862 79 ; Main: if (cardSuit(hand(3)) = HEARTS) OR (cardSuit(hand(3)) = DIAMONDS) LDI 3 ST fgbgColour + 1 LDWI _endif_0x1866 CALL giga_vAC ; Main: set FG_COLOUR, 3 _else_0x1862 LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 _endif_0x1866 LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 14 JumpEQ _elseif_0x18a9 81 ; Main: if cardValue(hand(3)) &= 14 LDI 100 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7da2 NewLine LDWI _endif_0x199f STLW 0xFE LDWI _page_0x35a0 CALL giga_vAC _page_0x35a0 LDLW 0xFE CALL giga_vAC ; Main: at 100,cardValueY : print "A" _elseif_0x18a9 LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 13 JumpEQ _elseif_0x18ec 82 ; Main: elseif cardValue(hand(3)) &= 13 LDI 100 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ca2 NewLine LDWI _endif_0x199f CALL giga_vAC ; Main: at 100,cardValueY : print "K" _elseif_0x18ec LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 12 JumpEQ _elseif_0x192f 83 ; Main: elseif cardValue(hand(3)) &= 12 LDI 100 ST cursorXY LDI 63 STLW 0xFE LDWI _page_0x36a0 CALL giga_vAC _page_0x36a0 LDLW 0xFE ST cursorXY + 1 AtTextCursor PrintString _str_0x7ba2 NewLine LDWI _endif_0x199f CALL giga_vAC ; Main: at 100,cardValueY : print "Q" _elseif_0x192f LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 11 JumpEQ _else_0x1972 84 ; Main: elseif cardValue(hand(3)) &= 11 LDI 100 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7aa2 NewLine LDWI _endif_0x199f CALL giga_vAC ; Main: at 100,cardValueY : print "J" _else_0x1972 LDI 100 ST cursorXY STLW 0xFE LDWI _page_0x37a0 CALL giga_vAC _page_0x37a0 LDLW 0xFE LDI 63 ST cursorXY + 1 AtTextCursor LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK PrintAcInt16 NewLine ; Main: at 100,cardValueY : print cardValue(hand(3)) _endif_0x199f LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW spriteId LDI 104 ST spriteXY LDI 78 ADDI 8 ST spriteXY + 1 DrawSprite ; Main: sprite noFlip, cardSuit(hand(3)), 104, cardSuitY _endif_0x19c4 LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x6fcb ADDW memIndex0 PEEK XORI 1 JumpEQ _endif_0x1bfe 95 ; Main: if cardState(hand(4)) &= DRAWN LDW _currentRound STLW 0xFE LDWI _page_0x38a0 CALL giga_vAC _page_0x38a0 LDLW 0xFE XORI 2 JumpEQ _endif_0x1a28 87 ; Main: if currentRound &= DRAW LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 LDI 127 STW drawRectF_x1 LDI 60 STW drawRectF_y1 LDI 156 STW drawRectF_x2 LDI 107 STW drawRectF_y2 DrawRectF ; Main: rectf 127, cardBorderY, 156, cardBorderY2 LDI 21 ST fgbgColour + 1 ; Main: set FG_COLOUR, 21 LDI 128 STW drawRectF_x1 LDI 61 STW drawRectF_y1 LDI 155 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 128, cardY, 155, cardY2 _endif_0x1a28 LDI 8 STW waitVBlankNum WaitVBlanks ; Main: WAIT 8 LDWI _playSndCardFlip CALL giga_vAC ; Main: gosub playSndCardFlip LDI 63 ST fgbgColour + 1 ; Main: set FG_COLOUR, 63 LDI 128 STW drawRectF_x1 LDI 61 STW drawRectF_y1 STLW 0xFE LDWI _page_0x39a0 CALL giga_vAC _page_0x39a0 LDLW 0xFE LDI 155 STW drawRectF_x2 LDI 106 STW drawRectF_y2 DrawRectF ; Main: rectf 128, cardY, 155, cardY2 LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 2 CALL convertEqOpAddr STW 0xea LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORI 1 CALL convertEqOpAddr ORW 0xea JumpFalse _else_0x1a9c 88 ; Main: if (cardSuit(hand(4)) = HEARTS) OR (cardSuit(hand(4)) = DIAMONDS) LDI 3 ST fgbgColour + 1 LDWI _endif_0x1aa0 CALL giga_vAC ; Main: set FG_COLOUR, 3 _else_0x1a9c LDI 0 ST fgbgColour + 1 ; Main: set FG_COLOUR, 0 _endif_0x1aa0 LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 14 STLW 0xFE LDWI _page_0x3aa0 CALL giga_vAC _page_0x3aa0 LDLW 0xFE JumpEQ _elseif_0x1ae3 90 ; Main: if cardValue(hand(4)) &= 14 LDI 131 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7da2 NewLine LDWI _endif_0x1bd9 CALL giga_vAC ; Main: at 131,cardValueY : print "A" _elseif_0x1ae3 LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 13 JumpEQ _elseif_0x1b26 91 ; Main: elseif cardValue(hand(4)) &= 13 LDI 131 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ca2 STLW 0xFE LDWI _page_0x3ba0 CALL giga_vAC _page_0x3ba0 LDLW 0xFE NewLine LDWI _endif_0x1bd9 CALL giga_vAC ; Main: at 131,cardValueY : print "K" _elseif_0x1b26 LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 12 JumpEQ _elseif_0x1b69 92 ; Main: elseif cardValue(hand(4)) &= 12 LDI 131 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7ba2 NewLine LDWI _endif_0x1bd9 CALL giga_vAC ; Main: at 131,cardValueY : print "Q" _elseif_0x1b69 LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK XORI 11 STLW 0xFE LDWI _page_0x3ca0 CALL giga_vAC _page_0x3ca0 LDLW 0xFE JumpEQ _else_0x1bac 93 ; Main: elseif cardValue(hand(4)) &= 11 LDI 131 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor PrintString _str_0x7aa2 NewLine LDWI _endif_0x1bd9 CALL giga_vAC ; Main: at 131,cardValueY : print "J" _else_0x1bac LDI 131 ST cursorXY LDI 63 ST cursorXY + 1 AtTextCursor LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK PrintAcInt16 NewLine ; Main: at 131,cardValueY : print cardValue(hand(4)) _endif_0x1bd9 LDWI 0x71c9 PEEK STW memIndex0 STLW 0xFE LDWI _page_0x3da0 CALL giga_vAC _page_0x3da0 LDLW 0xFE LDWI 0x70cb ADDW memIndex0 PEEK STW spriteId LDI 135 ST spriteXY LDI 78 ADDI 8 ST spriteXY + 1 DrawSprite ; Main: sprite noFlip, cardSuit(hand(4)), 135, cardSuitY _endif_0x1bfe Return ; Main: return _sortCards PUSH LDI 0 STW _i ; Main: for i = 0 to 3 _next_0x1c05 LDI 1 ADDW _i STW 0xe8 LDI 1 ADDW _i STW _j ; Main: for j = (1 + i) to 4 _next_0x1c15 LDWI 0x71c5 ADDW _i PEEK STW _tempValue1 ; Main: tempValue1 = hand(i) LDWI 0x71c5 ADDW _j PEEK STW _tempValue2 ; Main: tempValue2 = hand(j) LDWI 0x71cb ADDW _tempValue1 PEEK STW 0xe8 LDWI 0x71cb ADDW _tempValue2 PEEK STW 0xea LDW 0xe8 SUBW 0xea JumpGT _endif_0x1c97 96 ; Main: if cardValue(tempValue1) &> cardValue(tempValue2) STLW 0xFE LDWI _page_0x3ea0 CALL giga_vAC _page_0x3ea0 LDLW 0xFE LDWI 0x71c5 ADDW _i PEEK STW _tempCard ; Main: tempCard = hand(i) LDWI 0x71c5 ADDW _j PEEK STW memValue LDWI 0x71c5 ADDW _i STW memAddr LDW memValue POKE memAddr ; Main: hand(i) = hand(j) LDWI 0x71c5 ADDW _j STW memAddr LDW _tempCard POKE memAddr ; Main: hand(j) = tempCard _endif_0x1c97 ForNextFarInc _j _next_0x1c15 4 ; Main: next j ForNextFarInc _i _next_0x1c05 3 ; Main: next i Return ; Main: return _checkHand PUSH LDI 0 STW _straightFlag ; Main: straightFlag = 0 LDI 0 STW _flushFlag ; Main: flushFlag = 0 LDI 0 STW _winType ; Main: winType = NONE LDI 31 ST fgbgColour + 1 ; Main: set FG_COLOUR, 31 STLW 0xFE LDWI _page_0x3fa0 CALL giga_vAC _page_0x3fa0 LDLW 0xFE LDI 32 ST fgbgColour ; Main: set BG_COLOUR, 32 LDWI _sortCards CALL giga_vAC ; Main: gosub sortCards LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK STW _card0 ; Main: card0 = cardValue(hand(0)) LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK STW _card1 ; Main: card1 = cardValue(hand(1)) LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK STW _card2 ; Main: card2 = cardValue(hand(2)) LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK STW _card3 ; Main: card3 = cardValue(hand(3)) LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x71cb ADDW memIndex0 PEEK STW _card4 ; Main: card4 = cardValue(hand(4)) LDWI _flush CALL giga_vAC ; Main: gosub flush STLW 0xFE LDWI _page_0x40a0 CALL giga_vAC _page_0x40a0 LDLW 0xFE LDWI _straight CALL giga_vAC ; Main: gosub straight LDWI _royalFlush CALL giga_vAC ; Main: gosub royalFlush LDW _winType XORI 10 JumpEQ _endif_0x1d65 97 ; Main: if winType &= ROYALFLUSH LDI 250 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 250 * betAmount Return ; Main: return _endif_0x1d65 LDWI _straightFlush CALL giga_vAC ; Main: gosub straightFlush LDW _winType XORI 9 JumpEQ _endif_0x1d8d 98 ; Main: if winType &= STRAIGHTFLUSH LDI 50 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 50 * betAmount Return ; Main: return _endif_0x1d8d LDWI _fourOfAKind CALL giga_vAC ; Main: gosub fourOfAKind LDW _winType XORI 7 STLW 0xFE LDWI _page_0x41a0 CALL giga_vAC _page_0x41a0 LDLW 0xFE JumpEQ _endif_0x1db5 99 ; Main: if winType &= FOUROFAKIND LDI 25 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 25 * betAmount Return ; Main: return _endif_0x1db5 LDWI _fullHouse CALL giga_vAC ; Main: gosub fullHouse LDW _winType XORI 6 JumpEQ _endif_0x1ddd 100 ; Main: if winType &= FULLHOUSE LDI 9 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 9 * betAmount Return ; Main: return _endif_0x1ddd LDW _flushFlag XORI 1 JumpEQ _endif_0x1e04 101 ; Main: if flushFlag &= 1 LDI 5 STW _winType ; Main: winType = FLUSH LDI 6 STW mathX LDW _betAmount STW mathY LDWI multiply16bit STLW 0xFE LDWI _page_0x42a0 CALL giga_vAC _page_0x42a0 LDLW 0xFE CALL giga_vAC STW _winAmount ; Main: winAmount = 6 * betAmount Return ; Main: return _endif_0x1e04 LDW _straightFlag XORI 1 JumpEQ _endif_0x1e2b 102 ; Main: if straightFlag &= 1 LDI 4 STW _winType ; Main: winType = STRAIGHT LDI 4 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 4 * betAmount Return ; Main: return _endif_0x1e2b LDWI _threeOfAKind CALL giga_vAC ; Main: gosub threeOfAKind LDW _winType XORI 3 JumpEQ _endif_0x1e53 103 ; Main: if winType &= THREEOFAKIND LDI 3 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 3 * betAmount Return ; Main: return _endif_0x1e53 LDWI _twoPair CALL giga_vAC ; Main: gosub twoPair LDW _winType XORI 2 STLW 0xFE LDWI _page_0x43a0 CALL giga_vAC _page_0x43a0 LDLW 0xFE JumpEQ _endif_0x1e7b 104 ; Main: if winType &= TWOPAIR LDI 2 STW mathX LDW _betAmount STW mathY LDWI multiply16bit CALL giga_vAC STW _winAmount ; Main: winAmount = 2 * betAmount Return ; Main: return _endif_0x1e7b LDWI _jacksOrBetter CALL giga_vAC ; Main: gosub jacksOrBetter LDW _winType XORI 1 JumpEQ _endif_0x1e96 105 ; Main: if winType &= JACKSORBETTER LDW _betAmount STW _winAmount ; Main: winAmount = betAmount Return ; Main: return _endif_0x1e96 Return ; Main: return _jacksOrBetter PUSH LDI 0 STW _i ; Main: for i = 0 to 4 _next_0x1e9d LDWI 0x71c5 ADDW _i PEEK STW _tempValue1 ; Main: tempValue1 = hand(i) LDW _i ADDI 1 STW memIndex0 LDWI 0x71c5 ADDW memIndex0 PEEK STW _tempValue2 ; Main: tempValue2 = hand(i+1) LDWI 0x71cb ADDW _tempValue1 PEEK STW 0xe8 STLW 0xFE LDWI _page_0x44a0 CALL giga_vAC _page_0x44a0 LDLW 0xFE LDWI 0x71cb ADDW _tempValue2 PEEK XORW 0xe8 CALL convertEqOpAddr STW 0xea LDWI 0x71cb ADDW _tempValue2 PEEK SUBI 10 CALL convertGtOpAddr ANDW 0xea JumpFalse _endif_0x1f07 106 ; Main: if (cardValue(tempValue1) = cardValue(tempValue2)) AND (cardValue(tempValue2) > 10) LDI 1 STW _winType ; Main: winType = JACKSORBETTER _endif_0x1f07 ForNextFarInc _i _next_0x1e9d 4 ; Main: next i Return ; Main: return _twoPair PUSH LDW _card0 XORW _card1 CALL convertEqOpAddr STW 0xe8 LDW _card2 XORW _card3 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _elseif_0x1f41 107 ; Main: if (card0 = card1) AND (card2 = card3) LDI 2 STW _winType LDWI _endif_0x1f8e CALL giga_vAC ; Main: winType = TWOPAIR STLW 0xFE LDWI _page_0x45a0 CALL giga_vAC _page_0x45a0 LDLW 0xFE _elseif_0x1f41 LDW _card1 XORW _card2 CALL convertEqOpAddr STW 0xe8 LDW _card3 XORW _card4 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _elseif_0x1f6a 108 ; Main: elseif (card1 = card2) AND (card3 = card4) LDI 2 STW _winType LDWI _endif_0x1f8e CALL giga_vAC ; Main: winType = TWOPAIR _elseif_0x1f6a LDW _card0 XORW _card1 CALL convertEqOpAddr STW 0xe8 LDW _card3 XORW _card4 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x1f8e 109 ; Main: elseif (card0 = card1) AND (card3 = card4) LDI 2 STW _winType ; Main: winType = TWOPAIR _endif_0x1f8e Return ; Main: return _threeOfAKind PUSH LDI 0 STW _i ; Main: for i = 0 to 2 _next_0x1f95 LDWI 0x71c5 ADDW _i PEEK STW _tempValue1 ; Main: tempValue1 = hand(i) LDW _i ADDI 1 STW memIndex0 LDWI 0x71c5 STLW 0xFE LDWI _page_0x46a0 CALL giga_vAC _page_0x46a0 LDLW 0xFE ADDW memIndex0 PEEK STW _tempValue2 ; Main: tempValue2 = hand(i+1) LDW _i ADDI 2 STW memIndex0 LDWI 0x71c5 ADDW memIndex0 PEEK STW _tempValue3 ; Main: tempValue3 = hand(i+2) LDWI 0x71cb ADDW _tempValue1 PEEK STW 0xe8 LDWI 0x71cb ADDW _tempValue2 PEEK XORW 0xe8 CALL convertEqOpAddr STW 0xea LDWI 0x71cb ADDW _tempValue2 PEEK STW 0xec LDWI 0x71cb ADDW _tempValue3 PEEK XORW 0xec CALL convertEqOpAddr ANDW 0xea JumpFalse _endif_0x201f 110 ; Main: if (cardValue(tempValue1) = cardValue(tempValue2)) AND (cardValue(tempValue2) = cardValue(tempValue3)) LDI 3 STW _winType ; Main: winType = THREEOFAKIND _endif_0x201f ForNextFarInc _i _next_0x1f95 2 ; Main: next i STLW 0xFE LDWI _page_0x47a0 CALL giga_vAC _page_0x47a0 LDLW 0xFE Return ; Main: return _straight PUSH LDW _card3 ADDI 1 XORW _card4 CALL convertEqOpAddr STW 0xea LDW _card3 ADDI 1 STW 0xec LDW _card2 ADDI 2 XORW 0xec CALL convertEqOpAddr ANDW 0xea STW 0xee LDW _card2 ADDI 2 STW 0xe8 LDW _card1 ADDI 3 XORW 0xe8 CALL convertEqOpAddr ANDW 0xee STW 0xea LDW _card1 ADDI 3 STW 0xec LDW _card0 ADDI 4 XORW 0xec CALL convertEqOpAddr ANDW 0xea JumpFalse _elseif_0x209f 111 ; Main: if (card4 = card3+1) AND (card3+1 = card2+2) AND (card2+2 = card1+3) AND (card1+3 = card0+4) LDI 1 STW _straightFlag LDWI _endif_0x20ed CALL giga_vAC ; Main: straightFlag = 1 _elseif_0x209f LDW _card4 XORI 14 STLW 0xFE LDWI _page_0x48a0 CALL giga_vAC _page_0x48a0 LDLW 0xFE CALL convertEqOpAddr STW 0xe8 LDW _card0 XORI 2 CALL convertEqOpAddr ANDW 0xe8 STW 0xea LDW _card1 XORI 3 CALL convertEqOpAddr ANDW 0xea STW 0xec LDW _card2 XORI 4 CALL convertEqOpAddr ANDW 0xec STW 0xee LDW _card3 XORI 5 CALL convertEqOpAddr ANDW 0xee JumpFalse _endif_0x20ed 112 ; Main: elseif (card4 = ACE) AND (card0 = 2) AND (card1 = 3) AND (card2 = 4) AND (card3 = 5) LDI 1 STW _straightFlag ; Main: straightFlag = 1 _endif_0x20ed Return ; Main: return _flush PUSH LDWI 0x71c5 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW 0xea LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORW 0xea STLW 0xFE LDWI _page_0x49a0 CALL giga_vAC _page_0x49a0 LDLW 0xFE CALL convertEqOpAddr STW 0xee LDWI 0x71c6 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW 0xea LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORW 0xea CALL convertEqOpAddr ANDW 0xee STW 0xee LDWI 0x71c7 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW 0xea LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORW 0xea CALL convertEqOpAddr ANDW 0xee STW 0xee LDWI 0x71c8 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK STW 0xea STLW 0xFE LDWI _page_0x4aa0 CALL giga_vAC _page_0x4aa0 LDLW 0xFE LDWI 0x71c9 PEEK STW memIndex0 LDWI 0x70cb ADDW memIndex0 PEEK XORW 0xea CALL convertEqOpAddr ANDW 0xee JumpFalse _endif_0x21c0 113 ; Main: if (cardSuit(hand(0)) = cardSuit(hand(1))) AND (cardSuit(hand(1)) = cardSuit(hand(2))) AND (cardSuit(hand(2)) = cardSuit(hand(3))) AND (cardSuit(hand(3)) = cardSuit(hand(4))) LDI 1 STW _flushFlag ; Main: flushFlag = 1 _endif_0x21c0 Return ; Main: return _fullHouse PUSH LDW _card0 XORW _card1 CALL convertEqOpAddr STW 0xe8 LDW _card1 XORW _card2 CALL convertEqOpAddr ANDW 0xe8 STW 0xea LDW _card3 XORW _card4 CALL convertEqOpAddr ANDW 0xea JumpFalse _elseif_0x21fa 114 ; Main: if (card0 = card1) AND (card1 = card2) AND (card3 = card4) LDI 6 STW _winType LDWI _endif_0x222c CALL giga_vAC ; Main: winType = FULLHOUSE _elseif_0x21fa LDW _card0 XORW _card1 CALL convertEqOpAddr STW 0xe8 LDW _card2 STLW 0xFE LDWI _page_0x4ba0 CALL giga_vAC _page_0x4ba0 LDLW 0xFE XORW _card3 CALL convertEqOpAddr ANDW 0xe8 STW 0xea LDW _card3 XORW _card4 CALL convertEqOpAddr ANDW 0xea JumpFalse _endif_0x222c 115 ; Main: elseif (card0 = card1) AND (card2 = card3) AND (card3 = card4) LDI 6 STW _winType ; Main: winType = FULLHOUSE _endif_0x222c Return ; Main: return _fourOfAKind PUSH LDW _card0 XORW _card1 CALL convertEqOpAddr STW 0xe8 LDW _card1 XORW _card2 CALL convertEqOpAddr ANDW 0xe8 STW 0xea LDW _card2 XORW _card3 CALL convertEqOpAddr ANDW 0xea JumpFalse _elseif_0x2266 116 ; Main: if (card0 = card1) AND (card1 = card2) AND (card2 = card3) LDI 7 STW _winType LDWI _endif_0x2298 CALL giga_vAC ; Main: winType = FOUROFAKIND _elseif_0x2266 LDW _card1 XORW _card2 CALL convertEqOpAddr STW 0xe8 LDW _card2 XORW _card3 STLW 0xFE LDWI _page_0x4ca0 CALL giga_vAC _page_0x4ca0 LDLW 0xFE CALL convertEqOpAddr ANDW 0xe8 STW 0xea LDW _card3 XORW _card4 CALL convertEqOpAddr ANDW 0xea JumpFalse _endif_0x2298 117 ; Main: elseif (card1 = card2) AND (card2 = card3) AND (card3 = card4) LDI 7 STW _winType ; Main: winType = FOUROFAKIND _endif_0x2298 Return ; Main: return _straightFlush PUSH LDW _straightFlag XORI 1 CALL convertEqOpAddr STW 0xe8 LDW _flushFlag XORI 1 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x22bf 118 ; Main: if (straightFlag = 1) AND (flushFlag = 1) LDI 9 STW _winType ; Main: winType = STRAIGHTFLUSH _endif_0x22bf Return ; Main: return _royalFlush PUSH LDW _flushFlag XORI 1 CALL convertEqOpAddr STW 0xe8 LDW _card0 XORI 10 CALL convertEqOpAddr ANDW 0xe8 STW 0xea LDW _card1 XORI 11 CALL convertEqOpAddr ANDW 0xea STLW 0xFE LDWI _page_0x4da0 CALL giga_vAC _page_0x4da0 LDLW 0xFE STW 0xec LDW _card2 XORI 12 CALL convertEqOpAddr ANDW 0xec STW 0xee LDW _card3 XORI 13 CALL convertEqOpAddr ANDW 0xee STW 0xe8 LDW _card4 XORI 14 CALL convertEqOpAddr ANDW 0xe8 JumpFalse _endif_0x231e 119 ; Main: if (flushFlag = 1) AND (card0 = 10) AND (card1 = JACK) AND (card2 = QUEEN) AND (card3 = KING) AND (card4 = ACE) LDI 10 STW _winType ; Main: winType = ROYALFLUSH _endif_0x231e Return ; Main: return HALT ; Main: END ;**************************************************************************************************************************************** ;**************************************************************************************************************************************** ;* Internal runtime, DO NOT MODIFY PAST THIS POINT, modifications must be made in the original include files * ;**************************************************************************************************************************************** ;**************************************************************************************************************************************** romCheck EQU 0x63a1 convertEqOp EQU 0x61bc convertGtOp EQU 0x61b3 multiply16bit EQU 0x65cb divide16bit EQU 0x69a8 randMod16bit EQU 0x62ac scanlineMode EQU 0x61c5 waitVBlank EQU 0x62a0 waitVBlanks EQU 0x61ec resetVideoFlags EQU 0x61cf initClearFuncs EQU 0x61db clearVertBlinds EQU 0x66c9 clearCursorRow EQU 0x64cf drawHLine EQU 0x64a2 drawVLine EQU 0x6ba1 drawRect EQU 0x67c0 drawRectF EQU 0x66a1 drawSprite_ EQU 0x65a3 drawSprite EQU 0x68a1 soundAllOff EQU 0x62e9 soundOn EQU 0x62bf printInit EQU 0x62d3 printText EQU 0x67a7 printDigit EQU 0x63b8 printInt16 EQU 0x68ae printChar EQU 0x6ca0 atTextCursor EQU 0x63da newLineScroll EQU 0x6aa2 convertEqOpAddr EQU 0x00c0 convertNeOpAddr EQU 0x00c2 convertLeOpAddr EQU 0x00c4 convertGeOpAddr EQU 0x00c6 convertLtOpAddr EQU 0x00c8 convertGtOpAddr EQU 0x00ca convert8Arr2dAddr EQU 0x00cc convert8Arr3dAddr EQU 0x00ce convert16Arr2dAddr EQU 0x00d0 convert16Arr3dAddr EQU 0x00d2 realTimeStubAddr EQU 0x00d4 ; do *NOT* use register4 to register7 during time slicing realTimeAddr EQU register0 realTimeProc0 EQU register1 realTimeProc1 EQU register2 realTimeProc2 EQU register3 numericLabel EQU register0 defaultLabel EQU register1 lutLabs EQU register2 lutAddrs EQU register3 lutIndex EQU register8 romType EQU register0 romErrAddr EQU register1 romErrPixel EQU register2 romCheck LD giga_romType ANDI 0xFC SUBW romType BGE romC_return LDWI giga_vram STW romErrAddr romC_loop LD romErrPixel POKE romErrAddr INC romErrPixel BRA romC_loop ; flash left hand corner pixel indicating rom error romC_return RET ; convert equal to into a boolean convertEqOp BEQ convertEq_1 LDI 0 RET convertEq_1 LDI 1 RET ; convert greater than into boolean convertGtOp BGT convertGt_1 LDI 0 RET convertGt_1 LDI 1 RET ; do *NOT* use register4 to register7 during time slicing mathX EQU register8 mathY EQU register9 mathSum EQU register12 mathRem EQU register12 mathMask EQU register13 mathSign EQU register14 mathQuot EQU register15 mathShift EQU register15 mathBase EQU register10 mathPow EQU register11 mathResult EQU register14 ; accumulator = mathX * mathY, (result 16bit) multiply16bit LDI 0 STW mathSum LDW mathX BEQ multiply16_exit ; if x=0 then return 0 LDWI SYS_LSRW1_48 STW giga_sysFn LDW mathY multiply16_loop BEQ multiply16_exit ; if y=0 then return ANDI 1 BEQ multiply16_skip LDW mathSum ADDW mathX STW mathSum ; mathSum += mathX multiply16_skip LDW mathX LSLW STW mathX ; mathX = mathX <<1 LDW mathY SYS 48 STW mathY ; mathY = mathY >>1 BRA multiply16_loop %if TIME_SLICING multiply16_exit PUSH CALL realTimeStubAddr POP LDW mathSum %else multiply16_exit LDW mathSum %endif RET ; accumulator:mathRem = mathX / mathY, (results 16bit) divide16bit LDW mathX XORW mathY STW mathSign LDW mathX BGE divide16_pos0 LDI 0 SUBW mathX STW mathX divide16_pos0 LDW mathY BGE divide16_pos1 LDI 0 SUBW mathY STW mathY divide16_pos1 LDI 0 STW mathRem LDI 1 divide16_loop STW mathMask LDW mathRem LSLW STW mathRem LDW mathX BGE divide16_incr INC mathRem divide16_incr LDW mathX LSLW STW mathX LDW mathRem SUBW mathY BLT divide16_incx STW mathRem INC mathX divide16_incx LDW mathMask LSLW BNE divide16_loop %if TIME_SLICING PUSH CALL realTimeStubAddr POP %endif LDW mathSign BGE divide16_exit LDI 0 SUBW mathX RET divide16_exit LDW mathX RET randMod16bit PUSH LDWI SYS_Random_34 STW giga_sysFn SYS 34 STW mathX LDWI divide16bit CALL giga_vAC LDW mathRem POP RET ; do *NOT* use register4 to register7 during time slicing graphicsMode EQU register0 waitVBlankNum EQU register0 drawHLine_x1 EQU register0 drawHLine_y1 EQU register1 drawHLine_x2 EQU register2 drawHLine_x4 EQU register3 drawVLine_x1 EQU register0 drawVLine_y1 EQU register1 drawVLine_y2 EQU register2 drawVLine_y8 EQU register3 drawLine_x1 EQU register0 drawLine_y1 EQU register1 drawLine_x2 EQU register2 drawLine_y2 EQU register3 drawLine_xy1 EQU register0 drawLine_xy2 EQU register1 drawLine_dxy1 EQU register2 drawLine_dxy2 EQU register3 drawLine_dx1 EQU register4 ; register4 to register7 used for temp values, state will be invalidated during time slicing drawLine_dy1 EQU register5 drawLine_dx2 EQU register6 drawLine_dy2 EQU register7 drawLine_sx EQU register8 drawLine_sy EQU register9 drawLine_h EQU register10 drawLine_num EQU register11 drawLine_count EQU register12 drawLine_tmp EQU register13 drawLine_dx EQU register2 drawLine_dy EQU register3 drawLine_u EQU register8 drawLine_v EQU register9 drawLine_addr EQU register10 drawPixel_xy EQU register15 readPixel_xy EQU register15 drawCircle_cx EQU register0 drawCircle_cy EQU register1 drawCircle_r EQU register2 drawCircle_a EQU register3 drawCircle_d EQU register8 drawCircle_x EQU register9 drawCircle_y EQU register10 drawCircle_ch0 EQU register11 drawCircle_ch1 EQU register12 drawCircle_ch2 EQU register13 drawCircle_ch3 EQU register14 drawCircleF_x1 EQU register0 drawCircleF_y1 EQU register1 drawCircleF_x2 EQU register2 drawCircleF_cx EQU register15 drawCircleF_cy EQU register10 drawCircleF_r EQU register11 drawCircleF_v EQU register8 drawCircleF_w EQU register9 drawRect_x1 EQU register7 drawRect_y1 EQU register10 drawRect_x2 EQU register11 drawRect_y2 EQU register15 drawRectF_x1 EQU register0 drawRectF_y1 EQU register1 drawRectF_x2 EQU register2 drawRectF_y2 EQU register7 drawPoly_mode EQU register14 drawPoly_addr EQU register15 scanlineMode LDWI SYS_SetMode_v2_80 STW giga_sysFn LDW graphicsMode SYS 80 RET waitVBlank LD giga_videoY XORI 179 BNE waitVBlank %if TIME_SLICING PUSH CALL realTimeStubAddr POP %endif RET waitVBlanks PUSH waitVB_loop LDW waitVBlankNum SUBI 0x01 STW waitVBlankNum BGE waitVB_vblank POP RET waitVB_vblank LDWI waitVBlank CALL giga_vAC BRA waitVB_loop ; do *NOT* use register4 to register7 during time slicing xreset EQU register0 xcount EQU register1 ycount EQU register2 treset EQU register3 breset EQU register8 top EQU register9 bot EQU register10 vramAddr EQU register11 evenAddr EQU register12 clsAddress EQU register13 clsLines EQU register14 varAddress EQU register13 clrAddress EQU register13 clrLines EQU register14 clrWidth EQU register15 resetVideoFlags LDI giga_CursorX ; cursor x start STW cursorXY LDWI ON_BOTTOM_ROW_MSK ANDW miscFlags STW miscFlags ; reset on bottom row flag RET initClearFuncs PUSH LDWI resetVideoFlags CALL giga_vAC LDWI SYS_SetMemory_v2_54 ; setup fill memory SYS routine STW giga_sysFn LD fgbgColour ST giga_sysArg1 ; fill value POP RET ; clears the viewable screen using a vertical blinds effect clearVertBlinds PUSH LDWI initClearFuncs CALL giga_vAC LDI giga_vram >> 8 STW top clearVB_loopy LDI giga_xres ST giga_sysArg0 LDI 0 ST giga_sysArg2 ; low start address LD top ST giga_sysArg3 ; top line SYS 54 ; fill memory LDI giga_xres ST giga_sysArg0 LDI 0 ST giga_sysArg2 ; low start address LDWI giga_yres - 1 + 16 SUBW top ST giga_sysArg3 ; bottom line SYS 54 ; fill memory INC top ; next top line %if TIME_SLICING CALL realTimeStubAddr %endif LD top SUBI giga_yres / 2 + 8 BLT clearVB_loopy POP RET drawHLine PUSH LD drawHLine_x1 ST giga_sysArg2 ; low start address LD drawHLine_x2 SUBW drawHLine_x1 BGE drawHL_cont LD drawHLine_x2 ST giga_sysArg2 ; low start address LD drawHLine_x1 SUBW drawHLine_x2 drawHL_cont ADDI 1 ST giga_sysArg0 ; count LD fgbgColour + 1 ST giga_sysArg1 ; fill value LD drawHLine_y1 ADDI 8 ST giga_sysArg3 ; high start address LDWI SYS_SetMemory_v2_54 STW giga_sysFn SYS 54 ; fill memory %if TIME_SLICING CALL realTimeStubAddr %endif POP RET drawVLine PUSH LDW drawVLine_y2 SUBW drawVLine_y1 BGE drawVL_cont LDW drawVLine_y2 STW drawLine_tmp LDW drawVLine_y1 STW drawVLine_y2 LDW drawLine_tmp STW drawVLine_y1 ; if y2 < y1 then swap y2 with y1 drawVL_cont LD drawVLine_x1 ST giga_sysArg4 LD drawVLine_y1 ADDI 8 ST drawVLine_y1 ST giga_sysArg5 LDW drawVLine_y2 ADDI 8 ST drawVLine_y2 SUBW drawVLine_y1 SUBI 8 BLT drawVL_loop1 LDW fgbgColour STW giga_sysArg0 LDWI SYS_VDrawBits_134 STW giga_sysFn ; setup 8 pixel SYS routine LDW drawVLine_y2 SUBI 7 STW drawVLine_y8 ; 8 pixel chunks limit drawVL_loop0 LDI 0xFF ST giga_sysArg2 ; 8 pixels of fg and bg colour SYS 134 ; SYS_VDrawBits_134, 270 - 134/2 = 0xCB %if TIME_SLICING CALL realTimeStubAddr %endif LD giga_sysArg5 ADDI 8 ST giga_sysArg5 SUBW drawVLine_y8 BLT drawVL_loop0 ; all 8 pixel chunks drawVL_loop1 LD fgbgColour + 1 POKE giga_sysArg4 INC giga_sysArg5 LD giga_sysArg5 SUBW drawVLine_y2 BLE drawVL_loop1 ; remaining pixels POP RET drawRect PUSH LDW drawRect_x1 STW drawHLine_x1 LDW drawRect_y1 STW drawHLine_y1 LDW drawRect_x2 STW drawHLine_x2 LDWI drawHLine CALL giga_vAC LDW drawRect_y2 STW drawHLine_y1 LDWI drawHLine CALL giga_vAC LDW drawRect_x1 STW drawVLine_x1 LDW drawRect_y1 STW drawVLine_y1 LDW drawRect_y2 STW drawVLine_y2 LDWI drawVLine CALL giga_vAC LDW drawRect_x2 STW drawVLine_x1 LDW drawRect_y1 STW drawVLine_y1 LDW drawRect_y2 STW drawVLine_y2 LDWI drawVLine CALL giga_vAC POP RET drawRectF PUSH LDW drawRectF_y2 SUBW drawRectF_y1 BGE drawRF_loop LDW drawRectF_y2 STW drawLine_tmp LDW drawRectF_y1 STW drawRectF_y2 LDW drawLine_tmp STW drawRectF_y1 ;if y2 < y1 then swap y2 with y1 drawRF_loop LDW drawRectF_y1 STW drawHLine_y1 LDWI drawHLine CALL giga_vAC INC drawRectF_y1 LDW drawRectF_y1 SUBW drawRectF_y2 BLE drawRF_loop POP RET ; do *NOT* use register4 to register7 during time slicing spriteId EQU register0 spriteXY EQU register1 spriteAddrs EQU register2 drawSprite_ PUSH LDWI _spritesLut_ ADDW spriteId ADDW spriteId DEEK STW spriteAddrs ; get sprite address table drawS_loop LDW spriteAddrs DEEK ; get source address BEQ drawS_exit STW giga_sysArg0 INC spriteAddrs INC spriteAddrs LDW spriteAddrs DEEK ; get stripe destination offset ADDW spriteXY SYS 64 INC spriteAddrs INC spriteAddrs %if TIME_SLICING CALL realTimeStubAddr %endif BRA drawS_loop drawS_exit POP RET drawSprite PUSH LDWI SYS_Sprite6_v3_64 STW giga_sysFn LDWI drawSprite_ CALL giga_vAC POP RET audioAddr EQU register1 waveType EQU register2 midiNote EQU register4 ; register4 to register7 are the only free registers during time slicing midiCommand EQU register5 midiPtr EQU register6 sndChannel EQU register8 sndFrequency EQU register9 sndVolume EQU register10 sndWaveType EQU register11 musicStream EQU register8 musicNote EQU register9 musicCommand EQU register10 musicPtr EQU register11 soundAllOff LDWI 0x01FC STW sndChannel LDI 0 DOKE sndChannel ; turn off channel 0 INC sndChannel + 1 DOKE sndChannel ; turn off channel 1 INC sndChannel + 1 DOKE sndChannel ; turn off channel 2 INC sndChannel + 1 DOKE sndChannel ; turn off channel 3 RET soundOn LDWI SYS_LSRW1_48 STW giga_sysFn LDI 0xFC ST sndChannel LD sndFrequency SYS 48 ST sndFrequency ; right shift low byte of sndFrequency by 1 LDW sndFrequency ; format = high:8 low:07, (bit 7 of low byte = 0) DOKE sndChannel ; turn on channel RET ; do *NOT* use register4 to register7 during time slicing textStr EQU register0 textNum EQU register0 textBak EQU register0 textHex EQU register1 textLen EQU register2 textOfs EQU register3 textChr EQU register8 textFont EQU register9 textSlice EQU register10 scanLine EQU register11 digitMult EQU register12 digitIndex EQU register13 clearLoop EQU register14 printInit LDWI SYS_VDrawBits_134 STW giga_sysFn LDW fgbgColour STW giga_sysArg0 LD cursorXY + 1 ; xy = peek(256+2*y)*256 + x LSLW INC giga_vAC + 1 PEEK ST giga_sysArg4 + 1 LD cursorXY ST giga_sysArg4 ; xy position RET ; prints text string pointed to by textStr printText PUSH LDWI printInit CALL giga_vAC ; first byte is length printT_char INC textStr ; next char LDW textStr PEEK BEQ printT_exit ; check for delimiting zero ST textChr LDWI printChar CALL giga_vAC BRA printT_char printT_exit POP RET ; prints single digit in textNum printDigit PUSH LDW textNum printD_index SUBW digitMult BLT printD_cont STW textNum INC digitIndex BRA printD_index printD_cont LD digitIndex BEQ printD_exit ORI 0x30 ST textChr LDWI printChar CALL giga_vAC LDI 0x30 ST digitIndex printD_exit POP RET ; prints 16bit int in textNum printInt16 PUSH LDWI printInit CALL giga_vAC LDI 0 ST digitIndex LDW textNum BGE printI16_pos LDI 0x2D ST textChr LDWI printChar CALL giga_vAC LDI 0 SUBW textNum STW textNum printI16_pos LDWI 10000 STW digitMult LDWI printDigit CALL giga_vAC LDWI 1000 STW digitMult LDWI printDigit CALL giga_vAC LDI 100 STW digitMult LDWI printDigit CALL giga_vAC LDI 10 STW digitMult LDWI printDigit CALL giga_vAC LD textNum ORI 0x30 ST textChr LDWI printChar CALL giga_vAC POP RET ; prints char in textChr printChar LD textChr ANDI 0x7F ; char can't be bigger than 127 SUBI 82 BGE printC_text82 ADDI 50 BLT printC_exit ; char<32 exit STW textChr ; char-32 LDWI giga_text32 ; text font slice base address for chars 32-81 BRA printC_font printC_text82 STW textChr ; char-82 LDWI giga_text82 ; text font slice base address for chars 82+ printC_font STW textFont LD textChr LSLW LSLW ADDW textChr ADDW textFont STW textFont ; char*5 + textFont LDI 0x05 printC_slice ST textSlice LDW textFont ; text font slice base address LUP 0x00 ; get ROM slice ST giga_sysArg2 SYS 134 ; draw vertical slice, SYS_VDrawBits_134, 270 - 134/2 = 0xCB INC textFont ; next vertical slice INC giga_sysArg4 ; next x LD textSlice SUBI 1 BNE printC_slice ST giga_sysArg2 ; result of printC_slice is 0 SYS 134 ; draw last blank slice INC giga_sysArg4 ; using sysArg4 as a temporary cursor address for multiple char prints PUSH %if TIME_SLICING CALL realTimeStubAddr %endif LD cursorXY ADDI giga_xfont ST cursorXY SUBI giga_xres - giga_xfont ; last possible char on line BLE printC_pop LDWI newLineScroll ; next row, scroll at bottom CALL giga_vAC printC_pop POP printC_exit RET atTextCursor LD cursorXY SUBI giga_xres - giga_xfont BLE atTC_checkY LDI 0 ST cursorXY atTC_checkY LD cursorXY + 1 SUBI giga_yres - giga_yfont BLT atTC_resbot LDI giga_yres - giga_yfont ST cursorXY + 1 LDI ON_BOTTOM_ROW_BIT ORW miscFlags STW miscFlags ; set on bottom row flag RET atTC_resbot LDWI ON_BOTTOM_ROW_MSK ANDW miscFlags STW miscFlags ; reset on bottom row flag RET ; clears the top giga_yfont lines of pixels in preparation of text scrolling clearCursorRow PUSH LDWI SYS_SetMemory_v2_54 STW giga_sysFn ; setup fill memory SYS routine LD fgbgColour ST giga_sysArg1 ; fill value LDWI giga_videoTable PEEK ST giga_sysArg3 ; row0 high byte address LDI giga_yfont clearCR_loopy ST clearLoop LDI giga_xres ST giga_sysArg0 LDI 0 ST giga_sysArg2 ; low start address SYS 54 ; fill memory INC giga_sysArg3 ; next line LD clearLoop SUBI 1 BNE clearCR_loopy %if TIME_SLICING CALL realTimeStubAddr %endif LDWI printInit CALL giga_vAC ; re-initialise the SYS registers POP RET ; print from top row to bottom row, then start scrolling newLineScroll LDI giga_CursorX ; cursor x start ST cursorXY ST giga_sysArg4 LDI ENABLE_SCROLL_BIT ANDW miscFlags BNE newLS_cont0 ; is scroll on or off? RET newLS_cont0 PUSH LDI ON_BOTTOM_ROW_BIT ANDW miscFlags ; is on bottom row flag? BNE newLS_cont1 LD cursorXY + 1 ADDI giga_yfont ST cursorXY + 1 SUBI giga_yres BLT newLS_exit LDI giga_yres - giga_yfont ST cursorXY + 1 newLS_cont1 LDWI clearCursorRow CALL giga_vAC LDWI giga_videoTable STW scanLine %if TIME_SLICING newLS_scroll CALL realTimeStubAddr LDW scanLine %else newLS_scroll LDW scanLine %endif PEEK ADDI giga_yfont ANDI 0x7F SUBI giga_yfont BGE newLS_adjust ADDI giga_yfont newLS_adjust ADDI giga_yfont POKE scanLine INC scanLine ; scanline pointers are 16bits INC scanLine LD scanLine SUBI 0xF0 ; scanline pointers end at 0x01EE BLT newLS_scroll LDI ON_BOTTOM_ROW_BIT ORW miscFlags STW miscFlags ; set on bottom row flag newLS_exit LDWI printInit CALL giga_vAC ; re-initialise the SYS registers POP RET