2068 Code Bytes #6

Authors

Publication

Pub Details

Date

Pages

BASIC Terms

See all articles from SMUG Bytes v10 n4-7

Sixth installment of the Z80 series, providing corrections to the issue #5 map routine plus the FINDAT color-attribute routine that assigns display colors to map units and cities for three players, a PAPER routine for background attribute setting, and the PRUDG UDG printer used throughout the CONQUEST map display system. Full assembly listings with addresses and mnemonics.


Correction: In Last month’s routine (issue #5) kindly insert the following 3 bytes of code after address 60457 shoving everything else down 3 bytes:

60548 33            RLA
60459 203,30 RL H

The entry address FOR THE PRINT MAP routine than becomes 60479.

We now finish our routine to print a wrapping world map to the screen There also were 2 address counting errors as well.

This finishes the print a double wrapping map routine. Of course you may want different graphics so may have to write your own attribute routine. You can also have more than 21 UDGs with this routine and can put the pixels anywhere you like merely by changing the address at 60793. In fact we will be doing just that when we print the coordinates for the map with the following routine.

By making the coordinates a separate routine, we can choose to print them or not. In the editor, where we need human help (or chew up a lot more space with code) we don’t want the viewer to know where on the map we are. Whereas, in the game coordinates are a definite help. But we don’t want to take too much screen. So we decide to have both numbers of the coordinates take but one character space. Each number is only 3 pixels wide. Using only even numbers makes them easier to read and requires only half as many. As it is, each of 32 coordinate characters is going to require 8 bytes. They will go down the left side and across line 21 (Basic designations).

Our map is now complete with coordinates. How about being able to scroll the map in any direction one character at a time? We still have to add a cursor which shouldn’t go off screen or across the coordinates which will be the topic of the next issue.

6045823RLA
60459203,20RL H
60726230,192P1AND 192WE ONLY HAVE UNITS LEFT SO WE CAN WORK WITH ONLY THE TOP TO OWER BITS.
60728254,64CP 64
6073032,6JR NZ,P2
60732205,82,237CALL PAPER
60735198,6ADD A,6ADD Y INK
60737201RET
60738254,128P2CP 128
6074032,6JR NZ,P3
60742205,82,237CALL PAPER
60745198,2ADD A,2ADD R INK
60747201RET
60748205,62,237P3CALL PAPER
60751198,7ADD A,7
60753201RET
60754213PAPERPUSH DE
60755229PUSH HL
6075658,51,123LD A,(PLAYER)
60759167AND A
6076023RLA
6076123RLA
6076223RLA
6076323RLA
6076487LD D,A
6076530,0LD E,0
60767237,87SBC HL,DE
60769126LD A,(HL)
60770254,1CP 1SEA?
6077232,4JR NZ,PA2
6077462,8LD A,8
6077624,10JR PAOUT
60778254,4CP 4MT?
6078048,4JR NC,PA3
6078262,32LD A,32P=G
6078424,2JR PAOUT
6078662,40PA3LD A,40P=AQ
60788225PAOUTPOP HL
60789209POP DE
60790201RET
60791197PRUDGPUSH BC
60792229PUSH HL
6079333,88,255LD HL,65368
60796230,15AND 15
6079823RLA
6079923RLA
6080023RLA
60801133ADD A,L
60802111LD L,A
608036,8LD B,8
60805126UDGLD A,(HL)
6080618LD (DE),A
6080735INC HL
6080820INC D
6080916,250DJNZ UDG
60811225POP HL
60812193POP BC
60813201RET
6081458,173,204PRCOORLD A,(MAPCOX)THE STORAGE PLACE FOR THE UPPER LEFT COORDINATE OF THE SCREEN
6081717,0,64LD DE,16384(0,0 OF THE SCREEN)
6082033,62,208LD HL,COORDWHERE 00 FIRST PIXEL IS STORED
608236,12LD B,12
60825167AND A
6082631RRADIVIDE COORDINATES BY 2
6082748,16JR NC,EVEN
6082960INC ASET A TO NEXT HIGHER NUMBER
60830245AGAINPUSH AF
60831175XOR A
60832205,0,238CALL PRCOPRINT A BLANK
60835123LD A,EADJST DE TO NEXT PRINT POSITION
60836198,32LD A,32
6083895LD A,E
60839254,0CP 0
60841204,251,237CALL Z,SEAM
60844241POP AF
60845205,0,238EVENCALL PRCO
6084860INC A
60849254,33CP 33AT END OF COOR?
6085132,2JR NZ,NOTEND
6085362,1LD A,1RESET TO FIRST
60855245NOTENDPUSH AF
60856123AND A,E
60857198,32ADD A,32
6085995LD E,A
60860254,0CP 0
60862204,231,237CALL Z,SEAM
60865241POP AF
6086616,218DJNZ AGAINNOW DO ACROSS THE BOTTOM
6086817,192,80LD DE,20672
6087158,192,204LD A,(MAPCOY)GET THE Y COORDINATE
608746,16LD B,16
60876167AND A
6087731RRAAGAIN, DIVIDE BY 2
6087848,8JR NC,EVEN1
6088060INC A
60881245AGAPUSH AF
60882175XOR APRINT A BLANK
60883205,0,248CALL PRCO
6088619INC DEADJUST DE TO NEXT PRINT POSITION
60887241POP AF
60888205,0,238EVEN1CALL PRCO
6089119INC DE
6089260INC A
60893254,33CP 33TIME TO WRAP?
6089532,2JR NZ,NOTE
6089762,1LD A,1
6089916,236NOTEDJNZ AGANOW DO ATTRIBUTES BK INK ON W PAPER
6090133,0,88LD HL,ATTRO
6090462,56LD A,56
609066,22LD B,22
6090817,32,0LD DE,32
60911110PC4LD (HL),A
60912167AND A
6091325ADD HL,DE
6091416,251DJNZ PC4
609166,32LD B,32
60918119PC5LD (HL),A
6091935INC HL
6092016,252DJNZ PC5
60922201RET
60923122SEAMLD A,D
60924198,8ADD A,8
6092687LD D,A
60927201RET
60928229PRCOPUSH HL
60929245PUSH AF
60930197PUSH BC
60931213PUSH DE
60932254,32CP 32
6093440,24JR Z,ADH
60936167AND A
6093723RRA
6093823RRA
6093923RRA
6094022,0LD D,0
6094295LD E,A
60943167AND A
6094425ADD HL,DE
60945209POP DE
60946213PUSH DE
609476,8X1LD B,8
60949126PRCO1LD A,(HL)
6095035INC HL
6095120INC D
6095216,250DJNZ PRCO1
60954209POP DE
60955193POP BC
60956241POP AF
60957225POP HL
60958201RET
6095936ADHINC H
6096024,240JR X1

Image Gallery

Source Code

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

Scroll to Top