Prev: 58266 Up: Map Next: 58422
58296: Print Cards
Used by the routine at CheckCardType.
PrintAceCard 58296 SUB 3 A-=3.
58298 DEC B Decrease B by three.
58299 DEC B
58300 DEC B
This entry point is used by the routine at CheckCardType.
PrintNumberCard 58301 LD C,B Copy the original card value into C as we need B for the loop below.
58302 LD B,A Set a counter in B of the card number (this is the lower four bits).
58303 INC B Increment B by one, due to the way the loop below works.
58304 LD DE,30 The card UDG data blocks are 0030 in length, so store this in DE for the calculation.
58307 LD HL,58422 The card data begins from 58422 so store this in HL.
58310 XOR A Reset the flags.
58311 SBC HL,DE Subtract DE from HL as the loop will add it back and then it will be pointing to the beginning again.
FindCardUDGData_Loop 58313 ADD HL,DE Add 0030 to HL to move to the next block of card UDG data.
58314 DJNZ FindCardUDGData_Loop Decrease the card value counter by one and loop back to FindCardUDGData_Loop until the appropriate card UDG data block is found.
58316 LD (58723),HL Write the card UDG data block pointer to *PointerCardUDGData.
Work out the suit.
58319 LD B,4 Using the original card value, shift the upper four bits to be the lower four bits.
SuitShift_Loop 58321 SRL C
58323 DJNZ SuitShift_Loop
58325 LD A,C Write the calculated suit to *CurrentCardSuit.
58326 LD (58722),A
Now calculate the suit UDG data address.
58329 LD B,C Set a counter in B of the calculated suit (this is the upper four bits).
58330 INC B Increment B by one, due to the way the loop below works.
58331 LD DE,88 The suit UDG data blocks are 0088 in length, so store this in DE for the calculation.
58334 LD HL,59071 The suit UDG data begins from 59071 so store this in HL.
58337 XOR A Reset the flags.
58338 SBC HL,DE Subtract DE from HL as the loop will add it back and then it will be pointing to the beginning again.
FindSuitUDGData_Loop 58340 ADD HL,DE Add 0088 to HL to move to the next block of suit UDG data.
58341 DJNZ FindSuitUDGData_Loop Decrease the suit counter by one and loop back to FindSuitUDGData_Loop until the appropriate suit UDG data block is found.
58343 PUSH DE Set a counter in BC to the length of the suit UDG data block: 0088.
58344 POP BC
58345 LD DE,58983 Set the target in DE to Buffer_CardData.
58348 LDIR Copy the suit UDG data block to the card data buffer.
Set the card character-set to be the in-use font.
58350 LD HL,58207 Write 58207 to *CHARS.
58353 LD (23606),HL
Handle setting the colour of the card.
58356 LD A,19 BRIGHT: ON.
58358 RST 16
58359 LD A,1
58361 RST 16
58362 LD A,16 Set INK: BLACK.
58364 RST 16
58365 LD A,0
58367 RST 16
58368 LD A,(58722) Jump to PrintCard if *CurrentCardSuit is 2 or higher (so Spades or Clubs).
58371 CP 2
58373 JR NC,PrintCard
Else this card is a Diamonds or Hearts so set the INK appropriately.
58375 LD A,16 Set INK: RED.
58377 RST 16
58378 LD A,2
58380 RST 16
This entry point is used by the routine at CheckCardType.
PrintCard 58381 LD A,(59423) Fetch the current *CardPosition and store this in A.
58384 LD C,6 Each card is 6 character blocks in width, store this count in C.
58386 LD B,A Set a counter in B of the card position we're processing.
Subtract 6 from 38 the number of times for the current card position. For example; position 1 is: 38 - (1 * 6) = 32.
58387 LD A,38 A=38.
FindCardPosition_Loop 58389 SUB C A-=C.
58390 DJNZ FindCardPosition_Loop Decrease card position counter by one and loop back to FindCardPosition_Loop until the counter is zero.
58392 LD C,A Store the result in C, this is the column position.
58393 LD B,12 Set B to 12 this is the row position.
58395 LD DE,(58723) Retrieve *PointerCardUDGData for the current card.
PrintCard_Loop 58399 PUSH DE Stash the UDG data pointer on the stack.
58400 LD A,B Jump to PrintCard_Finish when the current print line is equal to 7.
58401 CP 7
58403 JR Z,PrintCard_Finish
58405 CALL 3554 Call 3554 (CL_SET) to change the co-ordinates in BC to a screen buffer address.
58408 POP DE Restore the UDG data pointer from the stack.
58409 PUSH BC Stash BC on the stack.
58410 LD BC,6 Set the number of characters to print in BC (0006).
58413 CALL 8252 Call PR_STRING to print to the screen.
58416 POP BC Restore BC from the stack.
58417 DEC B Decrease B by one.
58418 JR PrintCard_Loop Jump to PrintCard_Loop.
Housekeeping and return.
PrintCard_Finish 58420 POP DE Restore DE from the stack.
58421 RET Return.
Prev: 58266 Up: Map Next: 58422