Routines |
Prev: E313 | Up: Map | Next: E39A |
Used by the routine at PrintHand.
|
||||||||
CheckCardType | E33A | LD B,A | B=the original card value. | |||||
E33B | AND %00001111 | Convert the card value into a suit-less value (by keeping only bits 0-3). | ||||||
E33D | CP $09 | Jump to PrintNumberCard if A is lower than 09. | ||||||
E33F | JR C,PrintNumberCard | |||||||
E341 | CP $0C | Jump to PrintAceCard if A is equal to 0C. | ||||||
E343 | JR Z,PrintAceCard | |||||||
Anything else is a picture card, so work out what we're printing.
|
||||||||
E345 | LD HL,$E618 | HL=E618. | ||||||
E348 | LD DE,$0438 | DE=0438. | ||||||
E34B | SUB $08 | A-=08. | ||||||
E34D | SBC HL,DE | HL-=DE (with carry). | ||||||
CheckCardType_0 | E34F | ADD HL,DE | HL+=DE. | |||||
E350 | DEC A | Decrease A by one. | ||||||
E351 | JR NZ,CheckCardType_0 | Jump to CheckCardType_0 until A is zero. | ||||||
Work out the suit.
|
||||||||
E353 | LD A,$04 | A=04. | ||||||
CardTypeSuitShift_Loop | E355 | SRL B | Shift B right. | |||||
E357 | DEC A | Decrease A by one. | ||||||
E358 | JR NZ,CardTypeSuitShift_Loop | Jump back to CardTypeSuitShift_Loop until A is zero. | ||||||
E35A | LD DE,$010E | DE=010E. | ||||||
E35D | XOR A | Reset flags. | ||||||
E35E | SBC HL,DE | HL-=DE (with carry). | ||||||
E360 | INC B | Increment B by one. | ||||||
CheckCardType_1 | E361 | ADD HL,DE | HL+=DE. | |||||
E362 | DJNZ CheckCardType_1 | Decrease counter by one and loop back to CheckCardType_1 until counter is zero. | ||||||
E364 | LD ($5C36),HL | Write HL to *CHARS. | ||||||
E367 | LD DE,$02F8 | HL+=02F8. | ||||||
E36A | ADD HL,DE | |||||||
E36B | PUSH HL | Stash HL on the stack. | ||||||
E36C | LD HL,$E39A | Write Graphics_PictureCard to *PointerCardUDGData. | ||||||
E36F | LD ($E563),HL | |||||||
E372 | CALL PrintCard | Call PrintCard. | ||||||
Calculate the attribute buffer position for the card position currently being printed.
|
||||||||
E375 | LD A,($E81F) | A=*CardPosition. | ||||||
E378 | LD HL,$0006 | HL=0006. | ||||||
E37B | LD DE,$597B | DE=597B (attribute buffer location). | ||||||
E37E | EX DE,HL | Exchange the DE and HL registers. | ||||||
FindCardAttributePosition_Loop | E37F | ADD HL,DE | HL+=DE. | |||||
E380 | DEC A | Decrease A by one. | ||||||
E381 | JR NZ,FindCardAttributePosition_Loop | Jump to FindCardAttributePosition_Loop until A is zero. | ||||||
E383 | EX DE,HL | Exchange the DE and HL registers. | ||||||
E384 | POP HL | Restore the attributes pointer from the stack. | ||||||
E385 | LD C,$05 | Set the card height (05) to C. | ||||||
CopyCardAttributes_RowLoop | E387 | LD B,$06 | Set the card width (06) to B. | |||||
CopyCardAttributes_Loop | E389 | LD A,(HL) | Copy an attribute byte from *HL to *DE. | |||||
E38A | LD (DE),A | |||||||
E38B | INC HL | Increment both HL and DE by one. | ||||||
E38C | INC DE | |||||||
E38D | DJNZ CopyCardAttributes_Loop | Decrease the width counter by one and loop back to CopyCardAttributes_Loop until all the attributes in the row have been copied. | ||||||
E38F | PUSH HL | Stash HL on the stack. | ||||||
Move down one line, and to where the next row will start (06 less than one row ~ 20).
|
||||||||
E390 | LD HL,$001A | DE+=001A. | ||||||
E393 | ADD HL,DE | |||||||
E394 | EX DE,HL | |||||||
E395 | POP HL | Restore HL from the stack. | ||||||
E396 | DEC C | Decrease the height counter by one. | ||||||
E397 | JR NZ,CopyCardAttributes_RowLoop | Jump to CopyCardAttributes_RowLoop until the entire card has been printed. | ||||||
E399 | RET | Return. |
Prev: E313 | Up: Map | Next: E39A |