Jump to content
IGNORED

Assembly->XB link project


Opry99er

Recommended Posts

It's a label for a particular section of the map to be drawn. Not a value.

 

Labels only exist in your code and at *assembly time*. Just like equates. VERY important concept for you to understand. The label "1X1" does not exist in your executable code anywhere, and at run time there is no such location as "1X1".

 

Passing in a string to represent the map you want to draw is possible, but only complicates things, so why would you want to do that? I recommend you pass a number between 0 and 11 to make things really easy, or 1 and 12, then subtract 1 from that value in your assembly code. Use that number as an index in to your map. Since your maps are the same size, and since you now have them stored in a 1x12 configuration instead of 2x6, you can just multiply the passed value by the number of bytes in your map, and add that to the start of the map data.

Edited by matthew180
Link to comment
Share on other sites

Since your maps are the same size, and since you now have them stored in a 1x12 configuration instead of 2x6, you can just multiply the passed value by the number of bytes in your map, and add that to the start of the map data.

 

 

Makes perfect sense. =)

 

 

Labels only exist in your code and at *assembly time*. Just like equates. VERY important concept for you to understand. The label "1X1" does not exist in your executable code anywhere, and at run time there is no such location as "1X1".

 

so you're saying do an EQU for MAPDAT... then (since the maps are inline) just offset that equate by that many bytes to tell the code what to draw? That's interesting... I am going to try some stuff tonight. =) Thanks guys

 

 

Link to comment
Share on other sites

Owen, if you go back to your data arrangement from post #142, you can use this code. If you use other data arrangements, then the code that selects the map will need to be modified a little, but it is no big deal. I used a lookup table because it was just a lot easier than doing the math to calculate the data offset. This example passes the map to draw from XB into a predefine 16-bit variable reserved in the code, as I explained earlier. The order of the DEF statement MATTERS! So keep XPARMS first.

 

XB Code

 

 

5 CALL CLEAR
10 CALL LDAT

100 DATA 1,2,1,2,2,1,3,2,1,4,2,1,5,2,1,6,2,1,7,2,1,8,2,1
110 DATA 9,11,1,10,6,5,11,15,1,12,2,11,13,7,3,14,2,3
500 DATA 96,"C3C303030303FFFF",97,"C3C3C3C3C3C3C3C3",98,"FFFFC0C0C0C0C3C3",99,"C3C3C0C0C0C0FFFF"
510 DATA 100,"FFFF03030303C3C3",101,"FFFF00000000FFFF",102,"FFDFFFFFF7BFFDFF",103,"FFFDBFFBFFDFFEFF"
520 DATA 104,"C3241800C3241800",112,"181C36315E448212",113,"1818FFFF18181818",114,"0018382464D08202"
530 DATA 115,"03070E9C7830D0C8",120,"070F1F1C1C1F1F1F",121,"E0F0F83838F8F8F8",122,"8080F0888880C0E0"
540 DATA 123,"01010F1111010307",128,"005555FFDFFBBFFD",129,"FFF7BFEDFF00AAAA",130,"1CFC3F1E3E3EFEFF"
550 DATA 131,"30E0800000000000",132,"0603000000000003",136,"8104002002882200",137,"380AD1C988087337"
560 DATA 138,"01000000804000FF",139,"88C141602030180F",140,"0001070C3860C488",141,"7EC3003040000006"
570 DATA 142,"0181011322C60CF8",143,"00C0780CC6222311"

3400 PRINT "INIT COLOR..."
3430 RESTORE 100 :: FOR C=1 TO 14 :: READ CS,CF,CB :: CALL COLOR(CS,CF,CB) :: NEXT C

3435 PRINT "INIT TILES..."
3440 RESTORE 500 :: FOR C=1 TO 30 :: READ CN,CC$ :: CALL CHAR(CN,CC$) :: NEXT C

3500 PRINT "DONE"

3510 CALL CLEAR
3520 CALL SCREEN(2)

3600 MAP=1
3610 CALL SETMAP(MAP)
3630 CALL KEY(0,K,S) :: IF S=0 THEN 3630
3640 MAP=MAP+1
3650 IF MAP>12 THEN MAP=1
3660 GOTO 3610

4000 SUB LDAT
4010   PRINT "LOADING DATA..."
4020   CALL INIT
4030   CALL LOAD("DSK1.XBS")
4040 SUBEND

6000 SUB SETMAP(MAP)
6010   IF ADR<>0 THEN 6050
6020   CALL PEEK(16382,P,Q)
6030   ADR=P*256+Q+2
6050   IF MAP<1 OR MAP>12 THEN SUBEXIT
6060   CALL LOAD(ADR,0,MAP)
6070   CALL LINK("DRAW")
6080 SUBEND

 

 

 

Assembly

 

 

      DEF  XPARMS,DRAW

VDPWD  EQU  >8C00             * VDP RAM WRITE DATA
VDPWA  EQU  >8C02             * VDP RAM READ/WRITE ADDRESS

XBWS   EQU  >83E0             * Workspace when called from XB
R0LB   EQU  XBWS+1            * R0 low byte

SAVR11 DATA >0000             * Save R11 so BL can be used locally

XPARMS JMP  DRAW
PARM1  DATA 0
      DATA 0

OLDMAP DATA 0

DRAW
      MOV  R11,@SAVR11       * Save the return address to XB

      MOV  @PARM1,R2
      DEC  R2                * Zero offset adjust
      SLA  R2,1              * Multiply by 2 for table index
      MOV  @MAPTAB(R2),R1    * Load address to map from table

      LI   R0,322            * Start of VRAM screen name table (top left corner)
      LI   R4,12             * 12 rows of map data for viewport

* Set up the R2 counter each time a line is written.
REND
      LI   R2,28             * Write 28 bytes at a time (don't use hex if you don't have to)
      BL   @VMBWXB           * Write the line
      AI   R0,32             * R0 was not affected, so bump down 1 line in VRAM
      AI   R1,28             * Offset for next line of viewport
      DEC  R4                * Count the line
      JNE  REND              * Loop if not done

      MOV  @SAVR11,R11
      B    *R11              * Return the XB


**
* VDP Multiple Byte Write for XB
*
* Works just like VMBW, but adds the character offset required by XB.
*
VMBWXB
      MOVB @R0LB,@VDPWA      * Send low byte of VDP RAM write address
      ORI  R0,>4000          * Set read/write bits 14 and 15 to write (01)
      MOVB R0,@VDPWA         * Send high byte of VDP RAM write address
      ANDI R0,>3FFF          * Restore R0 to be as nondestructive as possible
VMBWLP
      MOVB *R1+,R3           * Write byte to temp register
      AI   R3,>6000          * Adjust for XB character offset
      MOVB R3,@VDPWD         * Write byte to VDP RAM
      DEC  R2                * Byte counter
      JNE  VMBWLP            * Check if done
      B    *R11


MAPTAB
      DATA MD01
      DATA MD01+28
      DATA MD02
      DATA MD02+28
      DATA MD03
      DATA MD03+28
      DATA MD04
      DATA MD04+28
      DATA MD05
      DATA MD05+28
      DATA MD06
      DATA MD06+28

 

 

 

Map data in a 2x6 configuration

 

 

MAPDAT
MD01   DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>8989,>7289    ;
      DATA >7272,>7089,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>7070,>7070    ;
* -- Map Row 1 --
      DATA >8989,>8989,>8989,>8966    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>6689,>8989,>8989    ;
      DATA >8989,>7070,>8889,>8988    ;
      DATA >888C,>8D8F,>8889,>8988    ;
      DATA >8889,>8989,>8989,>8988    ;
      DATA >8888,>8989,>7070,>7270    ;
* -- Map Row 2 --
      DATA >8989,>8888,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>6689,>6666,>6666    ;
      DATA >6666,>7089,>8970,>8888    ;
      DATA >888B,>8A8E,>8866,>6666    ;
      DATA >6666,>6689,>8988,>8888    ;
      DATA >8888,>8989,>7070,>7070    ;
* -- Map Row 3 --
      DATA >8988,>8888,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>6689,>6688,>8989    ;
      DATA >8966,>7070,>7070,>7070    ;
      DATA >8884,>8283,>8866,>8888    ;
      DATA >8888,>6689,>8866,>6666    ;
      DATA >6666,>8889,>7270,>7070    ;
* -- Map Row 4 --
      DATA >8988,>8888,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8889,>6689,>6670,>7270    ;
      DATA >8966,>7270,>7072,>7072    ;
      DATA >8988,>8888,>8866,>8888    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8866,>8889,>7072,>7070    ;
* -- Map Row 5 --
      DATA >8989,>8988,>8888,>8866    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >8888,>6666,>6689,>7072    ;
      DATA >7066,>7070,>7270,>8989    ;
      DATA >8989,>8888,>8866,>8888    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8866,>8989,>7070,>7070    ;
* -- Map Row 6 --
      DATA >8989,>8888,>8888,>6666    ;
      DATA >6666,>6666,>8888,>8866    ;
      DATA >8888,>8888,>8889,>8972    ;
      DATA >7266,>7270,>8989,>8989    ;
      DATA >8888,>8889,>8866,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8972,>7072,>7272    ;
* -- Map Row 7 --
      DATA >8988,>8866,>6666,>6666    ;
      DATA >6666,>6666,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >7066,>7070,>8989,>8988    ;
      DATA >8888,>8888,>8866,>8888    ;
      DATA >8988,>8888,>8888,>8889    ;
      DATA >8866,>8970,>7070,>7270    ;
* -- Map Row 8 --
      DATA >8988,>8866,>8888,>6666    ;
      DATA >6666,>6666,>8888,>8866    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>6688,>8866,>8889    ;
      DATA >8888,>8888,>8988,>8888    ;
      DATA >8866,>8972,>7070,>7070    ;
* -- Map Row 9 --
      DATA >8988,>8866,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8989,>7089,>8988,>8888    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>7270,>7070,>7070    ;
* -- Map Row 10 --
      DATA >8989,>8866,>8888,>8888    ;
      DATA >8888,>8888,>888C,>8D8F    ;
      DATA >8888,>8888,>8888,>8989    ;
      DATA >8972,>7070,>8989,>8888    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8889,>8989,>6666,>6666    ;
      DATA >6666,>7272,>7072,>7072    ;
* -- Map Row 11 --
      DATA >8989,>8866,>8888,>8888    ;
      DATA >8888,>8888,>888B,>8A8E    ;
      DATA >8888,>8888,>8889,>8989    ;
      DATA >7070,>7272,>8989,>8988    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8870,>8989,>6666,>6666    ;
      DATA >6666,>7272,>7070,>7070    ;
* -- Map Row 12 --
MD02   DATA >8988,>8866,>8888,>8888    ;
      DATA >8888,>8888,>8884,>8283    ;
      DATA >8888,>8888,>8889,>8970    ;
      DATA >7270,>7070,>7070,>8989    ;
      DATA >8888,>6666,>6666,>8889    ;
      DATA >7072,>7089,>6666,>6666    ;
      DATA >6666,>7072,>7066,>6666    ;
* -- Map Row 13 --
      DATA >8988,>8866,>6666,>6666    ;
      DATA >6666,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8889,>7070    ;
      DATA >7070,>7270,>2070,>7089    ;
      DATA >8989,>8989,>8889,>8870    ;
      DATA >2072,>7089,>6666,>6666    ;
      DATA >6672,>7272,>7066,>7070    ;
* -- Map Row 14 --
      DATA >8989,>8988,>8888,>8888    ;
      DATA >8866,>6666,>6667,>6767    ;
      DATA >6767,>6767,>8989,>7020    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >8989,>8989,>8989,>8988    ;
      DATA >7270,>7272,>6666,>6666    ;
      DATA >7072,>7270,>7066,>7070    ;
* -- Map Row 15 --
      DATA >8989,>8988,>8888,>8888    ;
      DATA >8888,>8888,>8867,>6767    ;
      DATA >6767,>6767,>7270,>7070    ;
      DATA >7072,>7270,>7070,>7270    ;
      DATA >7270,>7072,>7089,>8989    ;
      DATA >7070,>7270,>7289,>8972    ;
      DATA >7270,>7270,>6666,>6670    ;
* -- Map Row 16 --
      DATA >8C8D,>8F89,>8989,>8989    ;
      DATA >8989,>8988,>8867,>6667    ;
      DATA >6767,>6767,>7272,>7070    ;
      DATA >7270,>7070,>7270,>7072    ;
      DATA >7270,>7070,>7070,>7070    ;
      DATA >7070,>7272,>7272,>7070    ;
      DATA >7070,>7072,>6666,>6672    ;
* -- Map Row 17 --
      DATA >8B8A,>8E89,>8989,>8988    ;
      DATA >8888,>8888,>8866,>6767    ;
      DATA >7366,>6766,>8888,>7270    ;
      DATA >7072,>7270,>7072,>8989    ;
      DATA >7072,>7270,>7270,>7070    ;
      DATA >7072,>7270,>7089,>7272    ;
      DATA >7070,>7070,>6666,>6670    ;
* -- Map Row 18 --
      DATA >8482,>8389,>8988,>8888    ;
      DATA >8888,>8888,>8867,>6766    ;
      DATA >6767,>6767,>8888,>8970    ;
      DATA >7270,>7070,>7089,>8989    ;
      DATA >8888,>8888,>7072,>7088    ;
      DATA >8888,>8888,>8989,>8970    ;
      DATA >7070,>7270,>6666,>6670    ;
* -- Map Row 19 --
      DATA >6766,>6766,>6767,>8888    ;
      DATA >8888,>8888,>8867,>6767    ;
      DATA >6767,>6766,>8888,>8989    ;
      DATA >7072,>7272,>7089,>8988    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;
      DATA >7070,>7270,>7066,>7072    ;
* -- Map Row 20 --
      DATA >8989,>8988,>8866,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8889    ;
      DATA >8972,>7072,>7289,>8988    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8970,>7070,>7066,>7070    ;
* -- Map Row 21 --
      DATA >8989,>8988,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8972,>7072,>7089,>8988    ;
      DATA >8888,>6666,>7166,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7270,>7066,>7270    ;
* -- Map Row 22 --
      DATA >8989,>8888,>8867,>6766    ;
      DATA >6767,>6767,>8888,>8888    ;
      DATA >6688,>8888,>8888,>8888    ;
      DATA >8972,>7070,>8989,>8988    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7270,>7066,>7070    ;
* -- Map Row 23 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6766,>6767    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8989,>7272,>8989,>8888    ;
      DATA >8888,>7166,>6666,>6666    ;
      DATA >6666,>8888,>8888,>8889    ;
      DATA >8972,>7270,>7066,>7070    ;
* -- Map Row 24 --
MD03   DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8989,>7072,>8989,>8888    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8866,>8888,>8888,>8888    ;
      DATA >8989,>7070,>7066,>7272    ;
* -- Map Row 25 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8989,>7070,>8988,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8888,>8888,>8889    ;
      DATA >8972,>7070,>7066,>7070    ;
* -- Map Row 26 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8989,>8888    ;
      DATA >6767,>8888,>8888,>8888    ;
      DATA >8989,>7089,>8988,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8888,>8889,>8989    ;
      DATA >7270,>7067,>6767,>6770    ;
* -- Map Row 27 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8988,>8888    ;
      DATA >6767,>6767,>6788,>8888    ;
      DATA >8989,>8989,>898C,>8D8F    ;
      DATA >8888,>8888,>6666,>6666    ;
      DATA >6666,>8888,>8989,>8972    ;
      DATA >7070,>7067,>6767,>6770    ;
* -- Map Row 28 --
      DATA >8988,>8888,>8888,>6666    ;
      DATA >6666,>6667,>8888,>8888    ;
      DATA >8888,>8888,>6788,>8888    ;
      DATA >8989,>8988,>888B,>8A8E    ;
      DATA >8888,>8888,>6688,>8888    ;
      DATA >8888,>8888,>8989,>8989    ;
      DATA >7070,>7067,>6767,>6770    ;
* -- Map Row 29 --
      DATA >8989,>8888,>8888,>6688    ;
      DATA >8888,>8889,>8888,>8888    ;
      DATA >8888,>8888,>6788,>8888    ;
      DATA >8989,>8988,>8884,>8283    ;
      DATA >8888,>8888,>6688,>8888    ;
      DATA >8888,>8888,>8989,>8989    ;
      DATA >7270,>7070,>6767,>6772    ;
* -- Map Row 30 --
      DATA >8989,>8988,>8888,>6688    ;
      DATA >8889,>8989,>8888,>8888    ;
      DATA >8888,>8888,>6788,>8889    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8888,>6666,>6666    ;
      DATA >6666,>8889,>8989,>8970    ;
      DATA >7272,>7270,>6767,>6770    ;
* -- Map Row 31 --
      DATA >8989,>8989,>8988,>6688    ;
      DATA >8989,>8989,>8988,>8867    ;
      DATA >6767,>6767,>6788,>8889    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8888,>8989,>7070    ;
      DATA >7070,>7070,>6770,>7072    ;
* -- Map Row 32 --
      DATA >8989,>8989,>8888,>6688    ;
      DATA >8989,>8989,>8988,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8866,>8888,>8870,>7070    ;
      DATA >7070,>7070,>6770,>7070    ;
* -- Map Row 33 --
      DATA >8989,>8988,>8888,>6688    ;
      DATA >8989,>8989,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8989,>8889,>8989    ;
      DATA >8866,>8888,>7070,>7070    ;
      DATA >7272,>7070,>6770,>7270    ;
* -- Map Row 34 --
      DATA >8988,>8867,>6767,>6688    ;
      DATA >8889,>8989,>8888,>8866    ;
      DATA >6666,>6666,>6688,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>8989,>8989,>8988    ;
      DATA >8866,>8888,>7070,>7272    ;
      DATA >7272,>7270,>6770,>7070    ;
* -- Map Row 35 --
      DATA >8989,>8867,>6767,>6688    ;
      DATA >8888,>8889,>8989,>8888    ;
      DATA >8888,>8888,>6666,>6667    ;
      DATA >6767,>6666,>6666,>6666    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>8872,>7272,>7070    ;
      DATA >7270,>7270,>6770,>7070    ;
* -- Map Row 36 --
MD04   DATA >8988,>8867,>6767,>6788    ;
      DATA >8888,>8889,>8989,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8888,>8872,>7070,>7270    ;
      DATA >7072,>7270,>6770,>7020    ;
* -- Map Row 37 --
      DATA >7088,>8867,>6767,>6767    ;
      DATA >6767,>678C,>8D8F,>8988    ;
      DATA >8989,>8989,>8989,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8989,>8889,>8989    ;
      DATA >8888,>8888,>8888,>7072    ;
      DATA >7272,>7270,>6770,>7070    ;
* -- Map Row 38 --
      DATA >7088,>8867,>8888,>8888    ;
      DATA >8888,>678B,>8A8E,>8988    ;
      DATA >8989,>8888,>8888,>8889    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8989,>8989,>8989,>8988    ;
      DATA >8888,>8888,>8888,>8870    ;
      DATA >7072,>7070,>6770,>7070    ;
* -- Map Row 39 --
      DATA >7089,>8867,>6788,>8888    ;
      DATA >8888,>6784,>8283,>8989    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8989,>8989,>8888,>8889    ;
      DATA >8989,>8989,>8889,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >7070,>7070,>6770,>7270    ;
* -- Map Row 40 --
      DATA >7089,>8888,>6788,>8888    ;
      DATA >8888,>6767,>6667,>6667    ;
      DATA >6788,>8888,>8888,>8889    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8967,>6767,>6767,>6788    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8870,>7270,>6770,>7070    ;
* -- Map Row 41 --
      DATA >7070,>8988,>6788,>8C8D    ;
      DATA >8F88,>8889,>8989,>8888    ;
      DATA >6688,>8888,>8888,>8888    ;
      DATA >8988,>8989,>8989,>8989    ;
      DATA >8967,>8888,>8888,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6788,>7070,>6770,>7070    ;
* -- Map Row 42 --
      DATA >7070,>8989,>6788,>8B8A    ;
      DATA >8E88,>8889,>8989,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8888,>8989,>8989,>8989    ;
      DATA >8967,>8888,>8888,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6767,>6767,>6770,>7070    ;
* -- Map Row 43 --
      DATA >7070,>7067,>6788,>8482    ;
      DATA >8388,>8889,>8988,>8888    ;
      DATA >6767,>6667,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >6767,>8889,>8888,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6788,>7070,>7070,>7270    ;
* -- Map Row 44 --
      DATA >7070,>7067,>8888,>8888    ;
      DATA >8888,>8889,>8888,>8888    ;
      DATA >6767,>6767,>6767,>6688    ;
      DATA >8888,>8889,>8989,>8888    ;
      DATA >8888,>8889,>8988,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6788,>7070,>7070,>7270    ;
* -- Map Row 45 --
      DATA >7070,>7067,>7270,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >6767,>6767,>6767,>6788    ;
      DATA >8888,>7070,>8889,>8989    ;
      DATA >8989,>8989,>8988,>6688    ;
      DATA >8888,>8888,>6788,>8989    ;
      DATA >8989,>7072,>7072,>7070    ;
* -- Map Row 46 --
      DATA >7070,>7067,>7072,>7070    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >7270,>7067,>6767,>6788    ;
      DATA >8870,>7070,>7070,>7089    ;
      DATA >8989,>8989,>8989,>6666    ;
      DATA >6666,>6666,>6789,>8972    ;
      DATA >7270,>7272,>7070,>7072    ;
* -- Map Row 47 --
      DATA >7072,>7067,>7070,>7270    ;
      DATA >7070,>7072,>7272,>7070    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >7070,>7072,>7089,>7070    ;
      DATA >7070,>7089,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8972    ;
      DATA >7072,>7270,>7070,>7070    ;
* -- Map Row 48 --
MD05   DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >7089,>8989,>8989,>8989    ;
      DATA >7088,>8889,>8989,>8889    ;
      DATA >8989,>8989,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 49 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8989,>8989,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 50 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7289,>8989    ;
      DATA >8888,>8989,>8989,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8989,>8889,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 51 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7072,>8989,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8889,>8989,>8970    ;
      DATA >7070,>7020,>7070,>7070    ;
* -- Map Row 52 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7289,>8989,>8988    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8889,>8989,>8970    ;
      DATA >2070,>7070,>7070,>7070    ;
* -- Map Row 53 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>8989,>8989,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 54 --
      DATA >7070,>7067,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8989,>8989    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 55 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>6767,>7070,>7072    ;
      DATA >7289,>8967,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;
      DATA >8920,>7070,>7070,>7070    ;
* -- Map Row 56 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >8989,>8967,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8970,>7070,>7020,>7070    ;
* -- Map Row 57 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8967,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8989,>7020,>7070,>7020    ;
* -- Map Row 58 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7070,>7070,>7070    ;
* -- Map Row 59 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7270,>8988    ;
      DATA >8988,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7067,>6767,>6767    ;
* -- Map Row 60 --
MD06   DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7072,>7089,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8867,>6767    ;
      DATA >6767,>6767,>6767,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8889,>2067,>7070,>7070    ;
* -- Map Row 61 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7270,>8988,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8967,>2070,>7070    ;
* -- Map Row 62 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7072,>7289,>8989,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8C8D,>8F88,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8967,>7070,>7070    ;
* -- Map Row 63 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7270,>8989,>8988,>8888    ;
      DATA >8888,>8867,>888C,>8D8F    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8B8A,>8E88,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>7070,>7020    ;
* -- Map Row 64 --
      DATA >7070,>7070,>7070,>7072    ;
      DATA >7089,>8989,>8888,>8888    ;
      DATA >8888,>8867,>888B,>8A8E    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8482,>8388,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8970,>7070    ;
* -- Map Row 65 --
      DATA >7070,>7070,>7072,>7270    ;
      DATA >8989,>8988,>8888,>8888    ;
      DATA >8888,>8867,>8884,>8283    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8970,>7020    ;
* -- Map Row 66 --
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >6767,>6767,>6767,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8989,>7070    ;
* -- Map Row 67 --
      DATA >7070,>7070,>7072,>8989    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6767,>6767,>6767,>8888    ;
      DATA >8888,>8867,>8989,>7070    ;
* -- Map Row 68 --
      DATA >7070,>7070,>7270,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>8888    ;
      DATA >8888,>8867,>6789,>7070    ;
* -- Map Row 69 --
      DATA >7070,>7072,>7070,>8989    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>6767    ;
      DATA >6767,>6767,>6788,>8970    ;
* -- Map Row 70 --
      DATA >7070,>7272,>7089,>8988    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;
* -- Map Row 71 --
      DATA >7070,>7220,>7089,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;

      END

 

 

Edited by matthew180
Link to comment
Share on other sites

It's a label for a particular section of the map to be drawn. Not a value.

 

Labels only exist in your code and at *assembly time*. Just like equates. VERY important concept for you to understand. The label "1X1" does not exist in your executable code anywhere, and at run time there is no such location as "1X1".

 

Passing in a string to represent the map you want to draw is possible, but only complicates things, so why would you want to do that? I recommend you pass a number between 0 and 11 to make things really easy, or 1 and 12, then subtract 1 from that value in your assembly code. Use that number as an index in to your map. Since your maps are the same size, and since you now have them stored in a 1x12 configuration instead of 2x6, you can just multiply the passed value by the number of bytes in your map, and add that to the start of the map data.

 

 

 

 

"Labels only exist in your code and at *assembly time*. Just like equates. VERY important concept for you to understand. The label "1X1" does not exist in your executable code anywhere, and at run time there is no such location as "1X1"."

 

Forest for the trees Matt.... Your statement is incorrect.... Try and look at that statement from the outside.

Link to comment
Share on other sites

Here you go Owen, a little more interesting. By the way, there is a delay, so it could be faster. :)

 

XB Code

 

 

10 CALL CLEAR
20 CALL LDAT

100 DATA 1,2,1,2,2,1,3,2,1,4,2,1,5,2,1,6,2,1,7,2,1,8,2,1
110 DATA 9,11,1,10,6,5,11,15,1,12,2,11,13,7,3,14,2,3
500 DATA 96,"C3C303030303FFFF",97,"C3C3C3C3C3C3C3C3",98,"FFFFC0C0C0C0C3C3",99,"C3C3C0C0C0C0FFFF"
510 DATA 100,"FFFF03030303C3C3",101,"FFFF00000000FFFF",102,"FFDFFFFFF7BFFDFF",103,"FFFDBFFBFFDFFEFF"
520 DATA 104,"C3241800C3241800",112,"181C36315E448212",113,"1818FFFF18181818",114,"0018382464D08202"
530 DATA 115,"03070E9C7830D0C8",120,"070F1F1C1C1F1F1F",121,"E0F0F83838F8F8F8",122,"8080F0888880C0E0"
540 DATA 123,"01010F1111010307",128,"005555FFDFFBBFFD",129,"FFF7BFEDFF00AAAA",130,"1CFC3F1E3E3EFEFF"
550 DATA 131,"30E0800000000000",132,"0603000000000003",136,"8104002002882200",137,"380AD1C988087337"
560 DATA 138,"01000000804000FF",139,"88C141602030180F",140,"0001070C3860C488",141,"7EC3003040000006"
570 DATA 142,"0181011322C60CF8",143,"00C0780CC6222311"

3400 PRINT "INIT COLOR..."
3430 RESTORE 100 :: FOR C=1 TO 14 :: READ CS,CF,CB :: CALL COLOR(CS,CF,CB) :: NEXT C

3435 PRINT "INIT TILES..."
3440 RESTORE 500 :: FOR C=1 TO 30 :: READ CN,CC$ :: CALL CHAR(CN,CC$) :: NEXT C

3500 PRINT "DONE"

3510 CALL CLEAR
3520 CALL SCREEN(2)

3600 MX=1::MY=1
3610 CALL SETMAP(MX,MY)
3630 CALL KEY(0,K,S) :: IF S=0 THEN 3630
3640 IF K=ASC("W") THEN MY=MY-1::GOTO 3700
3650 IF K=ASC("S") THEN MY=MY+1::GOTO 3700
3660 IF K=ASC("A") THEN MX=MX-1::GOTO 3700
3670 IF K=ASC("D") THEN MX=MX+1::

3700 IF MX<1 THEN MX=1 ELSE IF MX>2 THEN MX=2
3710 IF MY<1 THEN MY=1 ELSE IF MY>6 THEN MY=6
3720 GOTO 3610

4000 SUB LDAT
4010   PRINT "LOADING DATA..."
4020   CALL INIT
4030   CALL LOAD("DSK1.XBS")
4040 SUBEND

6000 SUB SETMAP(MX,MY)
6010   X=MX::Y=MY
6020   IF ADR<>0 THEN 6050
6030   CALL PEEK(16382,P,Q)
6040   ADR=P*256+Q+2
6050   Y=Y-1::MAP=Y*2+X
6060   IF MAP<1 OR MAP>12 THEN SUBEXIT
6070   CALL LOAD(ADR,0,MAP)
6080   CALL LINK("DRAW")
6090 SUBEND

 

 

 

Assembly

 

 

      DEF  XPARMS,DRAW

VDPSTA EQU  >8802             * VDP status
VDPWD  EQU  >8C00             * VDP RAM WRITE DATA
VDPWA  EQU  >8C02             * VDP RAM READ/WRITE ADDRESS

XBWS   EQU  >83E0             * Workspace when called from XB
R0LB   EQU  XBWS+1            * R0 low byte

ROWSIZ EQU  28                * Length of 1 row in a map page
ROWPAG EQU  12                * Number of rows in a map page

SAVR11 DATA >0000             * Save R11 so BL can be used locally

XPARMS JMP  DRAW
PARM1  DATA 0                 * Parm 1
PARM2  DATA 0                 * Parm 2

VSTAT  DATA >8000             * VDP vsync status
CURLOC DATA MD01              * Current location

DRAW
      MOV  R11,@SAVR11       * Save the return address to XB

      MOV  @PARM1,R2
      DEC  R2                * Zero offset adjust
      SLA  R2,1              * Multiply by 2 for table index
      MOV  @MAPTAB(R2),R6    * Load address to map from table

      LI   R8,2              * Default the frame delay to 1 frame/sec

*      if cur_loc == 0 or new == cur_loc then skip scrolling
      MOV  @CURLOC,R1        * Currnet location
      JEQ  SKIP
      C    R1,R6
      JEQ  SKIP

* R1 = current location
* R5 = diff
* R6 = new location
* R7 = direction modifier
* R8 = frame delay
      MOV  R6,R5             * New map location
      S    R1,R5             * Diff = new - old
*      if diff < 0 then going up or left
      JGT  DNRT              * Signed compare, jump to down or right

      LI   R7,-1             * Assume going left, cur_loc = cur_loc - 1
      ABS  R5                * Make the diff positive to make comparing easier
*      if diff == ROWSIZ then going left
      CI   R5,ROWSIZ         * See if the diff is 1 row, ie. going left
      JEQ  REND              * If so, R8 is already set
      LI   R7,-ROWSIZ*2      * Going up, cur_loc = cur_loc - (ROWSIZ * 2)
      LI   R8,4              * Double the frame delay for up/down
      JMP  REND

* Down or Right
DNRT
      LI   R7,1              * Assume going right, cur_loc = cur_loc + 1
*      if diff == ROWSIZ then going right
      CI   R5,ROWSIZ         * See if the diff is 1 row, ie. going right
      JEQ  REND              * If so, R8 is already set
      LI   R7,ROWSIZ*2       * Going down, cur_loc = cur_loc + (ROWSIZ * 2)
      LI   R8,4              * Double the frame delay for up/down
      JMP  REND

* Set the current location equal to the new location so no animation.  Used
* for the first time a map is draw, or if the current map is requested again.
SKIP
      MOV  R6,R1

* At this point, register use is:
* R1 = current location
* R6 = new location
* R7 = current location modifier
* R8 = number of frames to wait between each draw

REND
      MOV  R1,R5             * Remember the current location to reset for animation

REND01
      MOV  R8,R9             * Frame counter

REND02
*      Wait for the VDP interrupt x number of times.
      CLR  R0
      MOVB @VDPSTA,R0        * Reading clears the VDP sync indicator
      COC  @VSTAT,R0         * Check if the interrupt bit is set
      JNE  REND02            * No VSYNC, poll again
      DEC  R9                * Count the frame
      JNE  REND02            * Wait again if delay is not done

      LI   R0,322            * Starting location in VRAM name table for viewport
      LI   R4,ROWPAG         * ROWPAG rows of map data for viewport

* Set up the R2 counter each time a line is written.
RENDLP
      LI   R2,ROWSIZ         * Write ROWSIZ bytes at a time
      BL   @VMBWXB           * Write the line
      AI   R0,32             * R0 was not affected, so bump down 1 line in VRAM
      AI   R1,ROWSIZ         * Offset for next line of viewport
      DEC  R4                * Count the line
      JNE  RENDLP            * Loop if not done

*      Test if done animating
      C    R5,R6
      JEQ  DONE

*      Adjust up, dn, lt, or rt.
      A    R7,R5             * Adjust the starting location 1 line or 1 tile
      MOV  R5,R1             * Reset R1 for VMBW
      JMP  REND01

DONE
      MOV  R6,@CURLOC        * Save the new current location

      MOV  @SAVR11,R11
      B    *R11              * Return the XB


**
* VDP Multiple Byte Write for XB
*
* Works just like VMBW, but adds the character offset required by XB.
*
VMBWXB
      MOVB @R0LB,@VDPWA      * Send low byte of VDP RAM write address
      ORI  R0,>4000          * Set read/write bits 14 and 15 to write (01)
      MOVB R0,@VDPWA         * Send high byte of VDP RAM write address
      ANDI R0,>3FFF          * Restore R0 to be as nondestructive as possible
VMBWLP
      MOVB *R1+,R3           * Write byte to temp register
      AI   R3,>6000          * Adjust for XB character offset
      MOVB R3,@VDPWD         * Write byte to VDP RAM
      DEC  R2                * Byte counter
      JNE  VMBWLP            * Check if done
      B    *R11


MAPTAB
      DATA MD01
      DATA MD01+28
      DATA MD02
      DATA MD02+28
      DATA MD03
      DATA MD03+28
      DATA MD04
      DATA MD04+28
      DATA MD05
      DATA MD05+28
      DATA MD06
      DATA MD06+28

 

 

 

Map data

 

 

MAPDAT
MD01   DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>8989,>7289    ;
      DATA >7272,>7089,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8989,>8989,>7070,>7070    ;
* -- Map Row 1 --
      DATA >8989,>8989,>8989,>8966    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>6689,>8989,>8989    ;
      DATA >8989,>7070,>8889,>8988    ;
      DATA >888C,>8D8F,>8889,>8988    ;
      DATA >8889,>8989,>8989,>8988    ;
      DATA >8888,>8989,>7070,>7270    ;
* -- Map Row 2 --
      DATA >8989,>8888,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>6689,>6666,>6666    ;
      DATA >6666,>7089,>8970,>8888    ;
      DATA >888B,>8A8E,>8866,>6666    ;
      DATA >6666,>6689,>8988,>8888    ;
      DATA >8888,>8989,>7070,>7070    ;
* -- Map Row 3 --
      DATA >8988,>8888,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>6689,>6688,>8989    ;
      DATA >8966,>7070,>7070,>7070    ;
      DATA >8884,>8283,>8866,>8888    ;
      DATA >8888,>6689,>8866,>6666    ;
      DATA >6666,>8889,>7270,>7070    ;
* -- Map Row 4 --
      DATA >8988,>8888,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8889,>6689,>6670,>7270    ;
      DATA >8966,>7270,>7072,>7072    ;
      DATA >8988,>8888,>8866,>8888    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8866,>8889,>7072,>7070    ;
* -- Map Row 5 --
      DATA >8989,>8988,>8888,>8866    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >8888,>6666,>6689,>7072    ;
      DATA >7066,>7070,>7270,>8989    ;
      DATA >8989,>8888,>8866,>8888    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8866,>8989,>7070,>7070    ;
* -- Map Row 6 --
      DATA >8989,>8888,>8888,>6666    ;
      DATA >6666,>6666,>8888,>8866    ;
      DATA >8888,>8888,>8889,>8972    ;
      DATA >7266,>7270,>8989,>8989    ;
      DATA >8888,>8889,>8866,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8972,>7072,>7272    ;
* -- Map Row 7 --
      DATA >8988,>8866,>6666,>6666    ;
      DATA >6666,>6666,>8888,>8866    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >7066,>7070,>8989,>8988    ;
      DATA >8888,>8888,>8866,>8888    ;
      DATA >8988,>8888,>8888,>8889    ;
      DATA >8866,>8970,>7070,>7270    ;
* -- Map Row 8 --
      DATA >8988,>8866,>8888,>6666    ;
      DATA >6666,>6666,>8888,>8866    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>6688,>8866,>8889    ;
      DATA >8888,>8888,>8988,>8888    ;
      DATA >8866,>8972,>7070,>7070    ;
* -- Map Row 9 --
      DATA >8988,>8866,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8989,>7089,>8988,>8888    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>7270,>7070,>7070    ;
* -- Map Row 10 --
      DATA >8989,>8866,>8888,>8888    ;
      DATA >8888,>8888,>888C,>8D8F    ;
      DATA >8888,>8888,>8888,>8989    ;
      DATA >8972,>7070,>8989,>8888    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8889,>8989,>6666,>6666    ;
      DATA >6666,>7272,>7072,>7072    ;
* -- Map Row 11 --
      DATA >8989,>8866,>8888,>8888    ;
      DATA >8888,>8888,>888B,>8A8E    ;
      DATA >8888,>8888,>8889,>8989    ;
      DATA >7070,>7272,>8989,>8988    ;
      DATA >8888,>6688,>8866,>8888    ;
      DATA >8870,>8989,>6666,>6666    ;
      DATA >6666,>7272,>7070,>7070    ;
* -- Map Row 12 --
MD02   DATA >8988,>8866,>8888,>8888    ;
      DATA >8888,>8888,>8884,>8283    ;
      DATA >8888,>8888,>8889,>8970    ;
      DATA >7270,>7070,>7070,>8989    ;
      DATA >8888,>6666,>6666,>8889    ;
      DATA >7072,>7089,>6666,>6666    ;
      DATA >6666,>7072,>7066,>6666    ;
* -- Map Row 13 --
      DATA >8988,>8866,>6666,>6666    ;
      DATA >6666,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8889,>7070    ;
      DATA >7070,>7270,>2070,>7089    ;
      DATA >8989,>8989,>8889,>8870    ;
      DATA >2072,>7089,>6666,>6666    ;
      DATA >6672,>7272,>7066,>7070    ;
* -- Map Row 14 --
      DATA >8989,>8988,>8888,>8888    ;
      DATA >8866,>6666,>6667,>6767    ;
      DATA >6767,>6767,>8989,>7020    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >8989,>8989,>8989,>8988    ;
      DATA >7270,>7272,>6666,>6666    ;
      DATA >7072,>7270,>7066,>7070    ;
* -- Map Row 15 --
      DATA >8989,>8988,>8888,>8888    ;
      DATA >8888,>8888,>8867,>6767    ;
      DATA >6767,>6767,>7270,>7070    ;
      DATA >7072,>7270,>7070,>7270    ;
      DATA >7270,>7072,>7089,>8989    ;
      DATA >7070,>7270,>7289,>8972    ;
      DATA >7270,>7270,>6666,>6670    ;
* -- Map Row 16 --
      DATA >8C8D,>8F89,>8989,>8989    ;
      DATA >8989,>8988,>8867,>6667    ;
      DATA >6767,>6767,>7272,>7070    ;
      DATA >7270,>7070,>7270,>7072    ;
      DATA >7270,>7070,>7070,>7070    ;
      DATA >7070,>7272,>7272,>7070    ;
      DATA >7070,>7072,>6666,>6672    ;
* -- Map Row 17 --
      DATA >8B8A,>8E89,>8989,>8988    ;
      DATA >8888,>8888,>8866,>6767    ;
      DATA >7366,>6766,>8888,>7270    ;
      DATA >7072,>7270,>7072,>8989    ;
      DATA >7072,>7270,>7270,>7070    ;
      DATA >7072,>7270,>7089,>7272    ;
      DATA >7070,>7070,>6666,>6670    ;
* -- Map Row 18 --
      DATA >8482,>8389,>8988,>8888    ;
      DATA >8888,>8888,>8867,>6766    ;
      DATA >6767,>6767,>8888,>8970    ;
      DATA >7270,>7070,>7089,>8989    ;
      DATA >8888,>8888,>7072,>7088    ;
      DATA >8888,>8888,>8989,>8970    ;
      DATA >7070,>7270,>6666,>6670    ;
* -- Map Row 19 --
      DATA >6766,>6766,>6767,>8888    ;
      DATA >8888,>8888,>8867,>6767    ;
      DATA >6767,>6766,>8888,>8989    ;
      DATA >7072,>7272,>7089,>8988    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;
      DATA >7070,>7270,>7066,>7072    ;
* -- Map Row 20 --
      DATA >8989,>8988,>8866,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8889    ;
      DATA >8972,>7072,>7289,>8988    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8970,>7070,>7066,>7070    ;
* -- Map Row 21 --
      DATA >8989,>8988,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8972,>7072,>7089,>8988    ;
      DATA >8888,>6666,>7166,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7270,>7066,>7270    ;
* -- Map Row 22 --
      DATA >8989,>8888,>8867,>6766    ;
      DATA >6767,>6767,>8888,>8888    ;
      DATA >6688,>8888,>8888,>8888    ;
      DATA >8972,>7070,>8989,>8988    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7270,>7066,>7070    ;
* -- Map Row 23 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6766,>6767    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8989,>7272,>8989,>8888    ;
      DATA >8888,>7166,>6666,>6666    ;
      DATA >6666,>8888,>8888,>8889    ;
      DATA >8972,>7270,>7066,>7070    ;
* -- Map Row 24 --
MD03   DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8989,>7072,>8989,>8888    ;
      DATA >8888,>6666,>6666,>8888    ;
      DATA >8866,>8888,>8888,>8888    ;
      DATA >8989,>7070,>7066,>7272    ;
* -- Map Row 25 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8989,>7070,>8988,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8888,>8888,>8889    ;
      DATA >8972,>7070,>7066,>7070    ;
* -- Map Row 26 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8989,>8888    ;
      DATA >6767,>8888,>8888,>8888    ;
      DATA >8989,>7089,>8988,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8888,>8889,>8989    ;
      DATA >7270,>7067,>6767,>6770    ;
* -- Map Row 27 --
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8988,>8888    ;
      DATA >6767,>6767,>6788,>8888    ;
      DATA >8989,>8989,>898C,>8D8F    ;
      DATA >8888,>8888,>6666,>6666    ;
      DATA >6666,>8888,>8989,>8972    ;
      DATA >7070,>7067,>6767,>6770    ;
* -- Map Row 28 --
      DATA >8988,>8888,>8888,>6666    ;
      DATA >6666,>6667,>8888,>8888    ;
      DATA >8888,>8888,>6788,>8888    ;
      DATA >8989,>8988,>888B,>8A8E    ;
      DATA >8888,>8888,>6688,>8888    ;
      DATA >8888,>8888,>8989,>8989    ;
      DATA >7070,>7067,>6767,>6770    ;
* -- Map Row 29 --
      DATA >8989,>8888,>8888,>6688    ;
      DATA >8888,>8889,>8888,>8888    ;
      DATA >8888,>8888,>6788,>8888    ;
      DATA >8989,>8988,>8884,>8283    ;
      DATA >8888,>8888,>6688,>8888    ;
      DATA >8888,>8888,>8989,>8989    ;
      DATA >7270,>7070,>6767,>6772    ;
* -- Map Row 30 --
      DATA >8989,>8988,>8888,>6688    ;
      DATA >8889,>8989,>8888,>8888    ;
      DATA >8888,>8888,>6788,>8889    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8888,>6666,>6666    ;
      DATA >6666,>8889,>8989,>8970    ;
      DATA >7272,>7270,>6767,>6770    ;
* -- Map Row 31 --
      DATA >8989,>8989,>8988,>6688    ;
      DATA >8989,>8989,>8988,>8867    ;
      DATA >6767,>6767,>6788,>8889    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8866,>8888,>8989,>7070    ;
      DATA >7070,>7070,>6770,>7072    ;
* -- Map Row 32 --
      DATA >8989,>8989,>8888,>6688    ;
      DATA >8989,>8989,>8988,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8866,>8888,>8870,>7070    ;
      DATA >7070,>7070,>6770,>7070    ;
* -- Map Row 33 --
      DATA >8989,>8988,>8888,>6688    ;
      DATA >8989,>8989,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8989,>8889,>8989    ;
      DATA >8866,>8888,>7070,>7070    ;
      DATA >7272,>7070,>6770,>7270    ;
* -- Map Row 34 --
      DATA >8988,>8867,>6767,>6688    ;
      DATA >8889,>8989,>8888,>8866    ;
      DATA >6666,>6666,>6688,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>8989,>8989,>8988    ;
      DATA >8866,>8888,>7070,>7272    ;
      DATA >7272,>7270,>6770,>7070    ;
* -- Map Row 35 --
      DATA >8989,>8867,>6767,>6688    ;
      DATA >8888,>8889,>8989,>8888    ;
      DATA >8888,>8888,>6666,>6667    ;
      DATA >6767,>6666,>6666,>6666    ;
      DATA >6666,>6666,>6666,>6666    ;
      DATA >6666,>8872,>7272,>7070    ;
      DATA >7270,>7270,>6770,>7070    ;
* -- Map Row 36 --
MD04   DATA >8988,>8867,>6767,>6788    ;
      DATA >8888,>8889,>8989,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8888,>8872,>7070,>7270    ;
      DATA >7072,>7270,>6770,>7020    ;
* -- Map Row 37 --
      DATA >7088,>8867,>6767,>6767    ;
      DATA >6767,>678C,>8D8F,>8988    ;
      DATA >8989,>8989,>8989,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8989,>8889,>8989    ;
      DATA >8888,>8888,>8888,>7072    ;
      DATA >7272,>7270,>6770,>7070    ;
* -- Map Row 38 --
      DATA >7088,>8867,>8888,>8888    ;
      DATA >8888,>678B,>8A8E,>8988    ;
      DATA >8989,>8888,>8888,>8889    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8989,>8989,>8989,>8988    ;
      DATA >8888,>8888,>8888,>8870    ;
      DATA >7072,>7070,>6770,>7070    ;
* -- Map Row 39 --
      DATA >7089,>8867,>6788,>8888    ;
      DATA >8888,>6784,>8283,>8989    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8989,>8989,>8888,>8889    ;
      DATA >8989,>8989,>8889,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >7070,>7070,>6770,>7270    ;
* -- Map Row 40 --
      DATA >7089,>8888,>6788,>8888    ;
      DATA >8888,>6767,>6667,>6667    ;
      DATA >6788,>8888,>8888,>8889    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8967,>6767,>6767,>6788    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8870,>7270,>6770,>7070    ;
* -- Map Row 41 --
      DATA >7070,>8988,>6788,>8C8D    ;
      DATA >8F88,>8889,>8989,>8888    ;
      DATA >6688,>8888,>8888,>8888    ;
      DATA >8988,>8989,>8989,>8989    ;
      DATA >8967,>8888,>8888,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6788,>7070,>6770,>7070    ;
* -- Map Row 42 --
      DATA >7070,>8989,>6788,>8B8A    ;
      DATA >8E88,>8889,>8989,>8888    ;
      DATA >6788,>8888,>8888,>8888    ;
      DATA >8888,>8989,>8989,>8989    ;
      DATA >8967,>8888,>8888,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6767,>6767,>6770,>7070    ;
* -- Map Row 43 --
      DATA >7070,>7067,>6788,>8482    ;
      DATA >8388,>8889,>8988,>8888    ;
      DATA >6767,>6667,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >6767,>8889,>8888,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6788,>7070,>7070,>7270    ;
* -- Map Row 44 --
      DATA >7070,>7067,>8888,>8888    ;
      DATA >8888,>8889,>8888,>8888    ;
      DATA >6767,>6767,>6767,>6688    ;
      DATA >8888,>8889,>8989,>8888    ;
      DATA >8888,>8889,>8988,>6688    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6788,>7070,>7070,>7270    ;
* -- Map Row 45 --
      DATA >7070,>7067,>7270,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >6767,>6767,>6767,>6788    ;
      DATA >8888,>7070,>8889,>8989    ;
      DATA >8989,>8989,>8988,>6688    ;
      DATA >8888,>8888,>6788,>8989    ;
      DATA >8989,>7072,>7072,>7070    ;
* -- Map Row 46 --
      DATA >7070,>7067,>7072,>7070    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >7270,>7067,>6767,>6788    ;
      DATA >8870,>7070,>7070,>7089    ;
      DATA >8989,>8989,>8989,>6666    ;
      DATA >6666,>6666,>6789,>8972    ;
      DATA >7270,>7272,>7070,>7072    ;
* -- Map Row 47 --
      DATA >7072,>7067,>7070,>7270    ;
      DATA >7070,>7072,>7272,>7070    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >7070,>7072,>7089,>7070    ;
      DATA >7070,>7089,>8989,>8989    ;
      DATA >8989,>8989,>8989,>8972    ;
      DATA >7072,>7270,>7070,>7070    ;
* -- Map Row 48 --
MD05   DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >7089,>8989,>8989,>8989    ;
      DATA >7088,>8889,>8989,>8889    ;
      DATA >8989,>8989,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 49 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8989,>8989,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8989,>8989,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 50 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7289,>8989    ;
      DATA >8888,>8989,>8989,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8989,>8889,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 51 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7072,>8989,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8889,>8989,>8970    ;
      DATA >7070,>7020,>7070,>7070    ;
* -- Map Row 52 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7289,>8989,>8988    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8889,>8989,>8970    ;
      DATA >2070,>7070,>7070,>7070    ;
* -- Map Row 53 --
      DATA >7070,>7067,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>8989,>8989,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8989,>8970    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 54 --
      DATA >7070,>7067,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8989,>8989    ;
      DATA >7070,>7070,>7070,>7070    ;
* -- Map Row 55 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>6767,>7070,>7072    ;
      DATA >7289,>8967,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;
      DATA >8920,>7070,>7070,>7070    ;
* -- Map Row 56 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7070,>7270    ;
      DATA >8989,>8967,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8970,>7070,>7020,>7070    ;
* -- Map Row 57 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8967,>6767,>6767    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8889    ;
      DATA >8989,>7020,>7070,>7020    ;
* -- Map Row 58 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7070,>7070,>7070    ;
* -- Map Row 59 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7070,>7270,>8988    ;
      DATA >8988,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8989,>7067,>6767,>6767    ;
* -- Map Row 60 --
MD06   DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7072,>7089,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8867,>6767    ;
      DATA >6767,>6767,>6767,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8889,>2067,>7070,>7070    ;
* -- Map Row 61 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7070,>7270,>8988,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8967,>2070,>7070    ;
* -- Map Row 62 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7072,>7289,>8989,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8C8D,>8F88,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8967,>7070,>7070    ;
* -- Map Row 63 --
      DATA >7070,>7070,>7070,>7070    ;
      DATA >7270,>8989,>8988,>8888    ;
      DATA >8888,>8867,>888C,>8D8F    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8B8A,>8E88,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>7070,>7020    ;
* -- Map Row 64 --
      DATA >7070,>7070,>7070,>7072    ;
      DATA >7089,>8989,>8888,>8888    ;
      DATA >8888,>8867,>888B,>8A8E    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8482,>8388,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8970,>7070    ;
* -- Map Row 65 --
      DATA >7070,>7070,>7072,>7270    ;
      DATA >8989,>8988,>8888,>8888    ;
      DATA >8888,>8867,>8884,>8283    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8867,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8970,>7020    ;
* -- Map Row 66 --
      DATA >7070,>7070,>7072,>7089    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>6767    ;
      DATA >6767,>6767,>6767,>6767    ;
      DATA >6767,>6767,>6767,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8989,>7070    ;
* -- Map Row 67 --
      DATA >7070,>7070,>7072,>8989    ;
      DATA >8989,>8888,>8888,>8888    ;
      DATA >8888,>8867,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>6767,>6767    ;
      DATA >6767,>6767,>6767,>8888    ;
      DATA >8888,>8867,>8989,>7070    ;
* -- Map Row 68 --
      DATA >7070,>7070,>7270,>8989    ;
      DATA >8988,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>8888    ;
      DATA >8888,>8867,>6789,>7070    ;
* -- Map Row 69 --
      DATA >7070,>7072,>7070,>8989    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>6767    ;
      DATA >6767,>6767,>6788,>8970    ;
* -- Map Row 70 --
      DATA >7070,>7272,>7089,>8988    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8867,>6767,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;
* -- Map Row 71 --
      DATA >7070,>7220,>7089,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8867    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8888    ;
      DATA >8888,>8888,>8888,>8989    ;

      END

 

 

Link to comment
Share on other sites

Here you go Owen, a little more interesting. By the way, there is a delay, so it could be faster. icon_smile.gif

 

 

Now THAT is somthing to make a video for!!! =) The animation is great! My wife who despises my TI work saw this running and said "wow, that's cool!"

 

 

=) I'll need to break down your source so I can understand exactly what's going on here. It is really REALLY slick. I never cease to be amazed at what is possible in assembly.

 

 

My next step is to work on the XB part of the game... placing a PC onscreen, setting up boundary check, etc. I have a preliminary battle engine which automates battle based on "level". Sort of a "Sword of Fargoal" kind of thing. I'll post the code for that tomorrow.

 

 

 

 

Link to comment
Share on other sites

I will be using 100% keyboard input, no joysticks for this one. I intend on making this less complicated than the ToD keyboard shortcuts, in that a simple "M" command will pull up a menu screen--from which most of your commands will be accessed. The only real issue I see is finding room for my graphic displays in memory.... On top of the current data in memory (the 12 maps) I will also need a few full screen menu options as well. This means adding 1 or 2k to what already exists and I'm not sure if that's going to be plausible. I could definitely use a smaller "window" for the menu.... Perhaps 16x16---- I could even do that display using strings in XB if needed..... More forthcoming today.

Link to comment
Share on other sites

=) I'll need to break down your source so I can understand exactly what's going on here. It is really REALLY slick. I never cease to be amazed at what is possible in assembly.

 

Break it down and ask questions. The first task would be to understand the non-scrolling one, since the scrolling is just an adaptation on the static version.

 

Also note that it currently has a few limitations. Always start at 1,1 and never "jump" to a location that is not adjacent to the current location.

 

Matthew

Link to comment
Share on other sites

"Labels only exist in your code and at *assembly time*. Just like equates. VERY important concept for you to understand. The label "1X1" does not exist in your executable code anywhere, and at run time there is no such location as "1X1"."

 

Forest for the trees Matt.... Your statement is incorrect.... Try and look at that statement from the outside.

 

Yeah, well, that's not the first time someone has said that to me.

 

I still have no idea what you are talking about though.

Link to comment
Share on other sites

"Labels only exist in your code and at *assembly time*. Just like equates. VERY important concept for you to understand. The label "1X1" does not exist in your executable code anywhere, and at run time there is no such location as "1X1"."

 

Forest for the trees Matt.... Your statement is incorrect.... Try and look at that statement from the outside.

 

Yeah, well, that's not the first time someone has said that to me.

 

I still have no idea what you are talking about though.

 

 

 

 

Hmmmmm I would agree that that made no sense at all. must have been real tired last night. Here is my point.....

 

A label is a conceptual item which makes it easier for use to deal with absolutes for example sound is an easier name to remember than >8400 but it is much the same. A Label used as an address marker again is easier to remember than an absolute address. This doesn't mean that when you assemble your code the labels are all of a sudden meaningless and or disappear. So conceptually labels are part and parcel of code regardless of whether it is source or object (somewhat esoteric I would admit.) It would be like saying the rojo does not mean red because it is in a different language.

 

Factually speaking, the XB loader requires label(s) in the REF/DEF table in order to execute assembly subroutines albeit a "TI" convention but none the less factual.

 

So..... is the VDP done yet ;-)

Link to comment
Share on other sites

True, but in the context that Owen was trying to use them, they do not exist. Owen wanted to pass "1X" from XB at run time and have that string select the map data in his code associated with a label. While possible via a lookup table that has the strings of label data in them associated with the addresses, that is not what Owen was thinking.

Link to comment
Share on other sites

True, but in the context that Owen was trying to use them, they do not exist. Owen wanted to pass "1X" from XB at run time and have that string select the map data in his code associated with a label. While possible via a lookup table that has the strings of label data in them associated with the addresses, that is not what Owen was thinking.

 

Well this just goes to prove one thing..... Owen is a dumb-ass..... ;-) Just kidding boy.....

Link to comment
Share on other sites

6000 SUB SETMAP(MX,MY)
6010 X=MX :: Y=MY
6020 IF ADR<>0 THEN 6050
6030 CALL PEEK(16382,P,Q)
6040 ADR=P*256+Q+2
6050 Y=Y-1 :: MAP=Y*2+X
6060 IF MAP<1 OR MAP>12 THEN SUBEXIT
6070 CALL LOAD(ADR,0,MAP)

 

The call peek and call load...

 

The CALL PEEK checks >3FFE and >3FFF and loads the two values into "P" and "Q" here in our XB program. Then the program calculates ADR by multiplying "P" by 256, adding "Q" to it, and adding 2 to the sum. Then, MAP is calculated by multiplying "Y" by 2 and adding "X" to it. Then, CALL LOAD is used to send two bytes to the calculated "ADR" location... the high byte is "0", the low byte is "MAP".

 

Tell me if I'm incorrect so far. A few questions on the XB side before I get to the assembly side---

 

 

 

-Why use >3FFE as the position to "check" with CALL PEEK

-ADR is obviously a location in memory where you are loading "MAP".... this address is calculated by your CALL PEEK of the two values.

 

***Why pass MAP to different memory locations? Would the CALL PEEK always give the same returns for the variables, P and Q, thereby giving the SAME memory location to load MAP to?

 

I understand line 6050:

 

 


6050 Y=Y-1 :: MAP=Y*2+X

 

This is a clever way to take an X,Y coordinate system and give it a single value... (1,2,3, etc).... Very nice. =)

 

I looked in the assembly source, and it looks like CURLOC is just that.... the CURrent LOCation... it starts at MD01, the top left part of the BIG map. Your XPARMS (defined first) are set initially to 0. So... I'm assuming that these labels will hold the parameter passed via CALL LOAD(ADR,0,MAP)....

 


  	MOV  @PARM1,R2
  	DEC  R2            	* Zero offset adjust
  	SLA  R2,1          	* Multiply by 2 for table index

 

At this point you're adding the value stored at PARM1 into R2.... but I do not see your usage for R2 in the register listing you listed...

 


* R1 = current location
* R5 = diff
* R6 = new location
* R7 = direction modifier
* R8 = frame delay

 

But, I can see that you DEC R2 for offset, making me believe that PARM1 contains the value you passed to assembly by the call load MAP in the XB program. If the map is "1" in XB, it becomes "0" in assembly.

 

-So, how does PARM1 receive the value you CALL LOADed, being that there is no EQU for PARM1?

-What is PARM2 used for?

 

 

Forgive me if these questions are elementary, I'm breaking this all down piece by piece and I'm hoping I'm on the right track....

 

 

 

Link to comment
Share on other sites

6000 SUB SETMAP(MX,MY)
6010 X=MX :: Y=MY
6020 IF ADR<>0 THEN 6050
6030 CALL PEEK(16382,P,Q)
6040 ADR=P*256+Q+2
6050 Y=Y-1 :: MAP=Y*2+X
6060 IF MAP<1 OR MAP>12 THEN SUBEXIT
6070 CALL LOAD(ADR,0,MAP)

 

The call peek and call load...

 

The CALL PEEK checks >3FFE and >3FFF and loads the two values into "P" and "Q" here in our XB program. Then the program calculates ADR by multiplying "P" by 256, adding "Q" to it, and adding 2 to the sum. Then, MAP is calculated by multiplying "Y" by 2 and adding "X" to it. Then, CALL LOAD is used to send two bytes to the calculated "ADR" location... the high byte is "0", the low byte is "MAP".

 

Tell me if I'm incorrect so far. A few questions on the XB side before I get to the assembly side---

 

You are correct so far. :)

 

-Why use >3FFE as the position to "check" with CALL PEEK

-ADR is obviously a location in memory where you are loading "MAP".... this address is calculated by your CALL PEEK of the two values.

 

This goes back to the REF/DEF table. The low 8K is >2000 to >4000. When you CALL INIT the bottom part of that memory (>2000 to something like >2400) is loaded with the LINK and LOAD subprograms. Then any assembly you load with CALL LOAD is loaded after that. The *exact* location where your code is loaded is required to use CALL LINK, as are the entry points of your routines. The entry points are anything you put in your DEF statement in your assembly code.

 

When you CALL LOAD, the loader will load your code, then make entries in the REF/DEF table for all the locations you DEFined. The REF/DEF (R/D) table is in a fixed known location (it has to be.) The R/D table starts at the top of the 8K space and grows *down* (towards smaller addresses.) The format is a fixed 8 bytes per entry. The first 6 bytes of an entry are the "ASCII" text of the label, the last two bytes are the 16-bit address for that label.

 

So, in this code, the XPARMS and DRAW labels are DEFined, so the R/D tables looks like this after CALL LOAD:

>2000
.
. Call init populates routines here
.
>2400 somewhere about here is the first free space in the low 8K

.
. Your assembly routines
.
>2502 JMP  >25F0    XPARMS address
>2504 DATA          PARM1 - 2 bytes
>2506 DATA          PARM2 - 2 bytes
.
.
.
>25F0 . . .         DRAW address

.
. REF/DEF table grows down
.
       1   2   3   4   5   6    7     8
>3FF0 | D | R | A | W |   |   | >25 | >F0 |
>3FF8 | X | P | A | R | M | S | >25 | >02 | - 1 entry is 8 bytes.
>4000

 

Ok, so we know the location of the R/D table, and we know the XPARMS reference will be the 1st entry in the table starting at >3FF8. XPARMS is what lets us know the address where we reserved space to pass parameters, so we need the address for the XPARMS entry. We don't care about the six bytes that make up the bytes of the label's name (call link uses that to find the routine you are calling), so we skip to the address of the MSB of the label's address, which is >3FF8 + 6, or >3FFE, or 16382 in decimal (which is what we have to use with CALL LOAD).

 

CALL LOAD can take multiple variables, so CALL LOAD(16382,P,Q) puts the byte at >3FFE into P and the byte at >3FFF into Q. Those two bytes make up the 16-bit address of where XPARMS is in memory. Since each byte of the address is now in its own XB variable, we need to make a 16-bit address from those bytes to use in another CALL LOAD. The MSB in P is shifted 8 bits to the left, which is the same as multiplying by 256. Then the LSB in Q is added to that value. This is just bit fiddling, and looks like this:

 

      MSB      LSB
P   00000000 00100101   (>0025)
Q   00000000 00000010   (>0002)

We need to move the >25 in the LSB of P to the MSB, so multiple by 256 (shift left 

P   00100101 00000000   (>2500)

Now add Q, which only affect the LSB and make the address:
P   00100101 00000000   (>2500)
Q   00000000 00000010   (>0002)
   -----------------
   00100101 00000010   (>2502)

 

Now, there is a JMP instruction at XPARMS in case it is accidentally called with LINK (CALL LINK("XPARMS")), it will just do the same as LINK("DRAW"), so that is just a safety thing an probably not necessary. But, the JMP instruction is 2 bytes, so our reserved data is two bytes beyond the address of XPARMS, so we add 2 to the address we got from the R/D table for XPARMS. Thus you have:

 

ADR=P*256+Q+2

 

Now ADR points to the MSB of the first reserved parameter memory we set up, PARM1.

 

***Why pass MAP to different memory locations? Would the CALL PEEK always give the same returns for the variables, P and Q, thereby giving the SAME memory location to load MAP to?

 

ADR is calculated once and does not change. We always pass the XB value in MAP to the same memory location.

 

ADR points to the PARM1 address, where we will place the requested map to display. This value is currently 1 to 12. Since PARM1 is 16-bit, and the value we are passing is less than 255, it will always go in the LSB of PARM1 to make a 16-bit number with the same value as the XB variable. CALL LOAD(ADR,0,MAP) will put >00 in the address at ADR, which is the MSB of PARM1, and the value of MAP (1 to 12) in the byte in memory following ADR, which is the LSB of PARM1:

 

ADR = >2504
MAP = 1 to 12
CALL LOAD(ADR,0,MAP)
>2504 = >00
>2505 = MAP

 

So when we treat PARM1 as a 16-bit value, it is 1 to 12.

 

 

I understand line 6050:

 


6050 Y=Y-1 :: MAP=Y*2+X

 

This is a clever way to take an X,Y coordinate system and give it a single value... (1,2,3, etc).... Very nice. =)

[/code]

 

That is a typical transformation to convert an X,Y location into a linear offset. That is exactly what you do when you convert a screen row/col into a VDP name table location:

 

offset = y * row_width + x

 

Depending if X and Y are 1-based, they may need adjustment, hence the Y=Y-1.

 

I looked in the assembly source, and it looks like CURLOC is just that.... the CURrent LOCation... it starts at MD01, the top left part of the BIG map. Your XPARMS (defined first) are set initially to 0. So... I'm assuming that these labels will hold the parameter passed via CALL LOAD(ADR,0,MAP)....

 

Yes, PARM1 is the only one currently used. It receives the value of MAP, 1 to 12.

 

 


  	MOV  @PARM1,R2
  	DEC  R2            	* Zero offset adjust
  	SLA  R2,1          	* Multiply by 2 for table index

 

At this point you're adding the value stored at PARM1 into R2.... but I do not see your usage for R2 in the register listing you listed...

 


* R1 = current location
* R5 = diff
* R6 = new location
* R7 = direction modifier
* R8 = frame delay

 

You missed the critical instruction:

 

MOV @MAPTAB(R2),R6

 

After that R2 is free for use later in the VMBW call. This instruction is an index, used to add the value in a register (the index) to a memory location (the table) to derive the address of the data you want to put into the destination (R6 in this case).

 

What we really want to do first in this whole mess is get the map data address that corresponds to the PARM1 map value of 1 to 12. To do this we need a table of the *addresses* where each map starts. We let the assembler do this for us like this:

 

MAPTAB
      DATA MD01
      DATA MD01+28
      DATA MD02
      DATA MD02+28
      DATA MD03
      DATA MD03+28
      DATA MD04
      DATA MD04+28
      DATA MD05
      DATA MD05+28
      DATA MD06
      DATA MD06+28

 

Now MAPTAB points to a list of addresses where each map starts. Since MAPTAB is zero-based, first we adjust the 1-12 map request into 0-11:

 

MOV @PARM1,R2

DEC R2

 

Then, because each address in the table is 2 bytes, the index needs to be multiplied by 2:

 

SLA R2,1

 

Now R2 is one of: 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22

 

So: MOV @MAPTAB(R2),R6

 

That takes the address at MAPTAB (the start of our table), and adds the value of R2 to that address. Let's say PARM1 was 4, or map 2,2:

 

PARM1 = 4

MOV @PARM1,R2    R2 = 4
DEC R2           R2 = 3
SLA R2,1         R2 = 6

* Break this instruction down:
MOV @MAPTAB(R2),R6
MOV @>2610 + 6, R6
MOV @>2616, R6

* R6 now holds the address of the data for map 2,2


* Addresses made up for this example.  Each map address is TWO BYTES, ie. a 16-bit address
>2610 MAPTAB
>2610       DATA MD01       Map 1,1
>2612       DATA MD01+28    Map 1,2
>2614       DATA MD02       Map 2,1
>2616       DATA MD02+28    Map 2,2
.
.
.

 

But, I can see that you DEC R2 for offset, making me believe that PARM1 contains the value you passed to assembly by the call load MAP in the XB program. If the map is "1" in XB, it becomes "0" in assembly.

 

-So, how does PARM1 receive the value you CALL LOADed, being that there is no EQU for PARM1?

-What is PARM2 used for?

 

I think the explanation above covers the first question. If not, let me know and I'll say things a different way.

 

PARM2 is currently unused, I just stuck it in there. This kind of table access is very typical and you will see it again and again. It is so common, TI included an addressing mode in the 9900 specifically for it! You can read about it in the 9900 datasheet or in boring detail on page 59 of the E/A manual. I'm sure Lotturp probably covers it a little too.

 

Matthew

Edited by matthew180
Link to comment
Share on other sites

  	DEF  XPARMS,DRAW

VDPSTA EQU  >8802         	* VDP status
VDPWD  EQU  >8C00         	* VDP RAM WRITE DATA
VDPWA  EQU  >8C02         	* VDP RAM READ/WRITE ADDRESS

XBWS   EQU  >83E0         	* Workspace when called from XB
R0LB   EQU  XBWS+1        	* R0 low byte

ROWSIZ EQU  28            	* Length of 1 row in a map page
ROWPAG EQU  12            	* Number of rows in a map page

SAVR11 DATA >0000         	* Save R11 so BL can be used locally

XPARMS JMP  DRAW
PARM1  DATA 0             	* Parm 1
PARM2  DATA 0             	* Parm 2

VSTAT  DATA >8000         	* VDP vsync status
CURLOC DATA MD01          	* Current location

DRAW
  	MOV  R11,@SAVR11   	* Save the return address to XB

  	MOV  @PARM1,R2

 

I'm still confused on one point... forgive me. =)

 

XPARMS and DRAW are in the REF/DEF table. This code I've pasted here is slightly confusing. How does PARM1 "get" the values from XB. I realize how XB sends the values, and even how the bytes following "XPARMS" in the REF/DEF table reveive 0 and "MAP"... but how does PARM1 reveive the byte that is placed in the REF DEF table by the XB program? There is no equate for PARM1 and PARM2. PARM1 in the above code is JUST a label and not noted in the DEF table. It just says "PARM1 DATA 0". So, between the XB sending the information and the "MOV @PARM1,R2", somehow PARM1 HAS to be loaded with 0 and MAP in the high and low bytes respectively. I don't understand how that works.

 

>3FF8 | X | P | A | R | M | S | >25 | >02 | - 1 entry is 8 bytes.

 

How is PARM1 able to get these bytes... it's really eating at me. I hope this makes sense... I've been trying to figure it out all day, and I might just be losing my mind and making no sense whatsoever. Thanks

 

 

 

Link to comment
Share on other sites

PARM1 does not "get" the bytes from XB. XB is putting the bytes in memory *at* PARM1. XB is not putting data *in* the REF/DEF table, it is simply using the pointers put in to the table by XB's loader. We know where PARM1 is because it immediately follows XPARMS in memory, and XPARMS is in our DEF directive so its address is put in the REF/DEF table.

 

A lot of this assumes you understand what labels are. In case you don't, here is a quick version. The assembler does a few things for us other than creating code from our mnemonics, one of them is keeping track of memory addresses and letting us use labels. Also, when writing assembly you will usually be writing "relocatable" code, unless you are writing a cartridge based program which, for the 99/4A, will always reside starting at address >6000. But, for use in XB with CALL LOAD, you have to create relocatable code. Unless you use an AORG directive, you are creating relocatable code.

 

It really helps to generate a "listing" file when assembling and look at the output, which shows what the assembler did, the memory locations it assigned, etc. Anyway, "relocatable" means the program can be put in memory pretty much anywhere, but to do that the loader needs to "fix up" memory references when the code is being loaded. The object code created by the assembler is in a format that has "hints" to tell the loader what addresses need modifying.

 

I guess I need an example, so here is a minimal XB assembly program and the listing:

 

      DEF XPARMS,DRAW

XPARMS JMP  DRAW
PARM1  DATA 0

DRAW
      MOV  @PARM1,R2
      B    *R11
      END

     ADDR|VALUE
     ----+-----
  1  0000 0000        DEF XPARMS,DRAW
  1  0000 0004  
  2            
  3  0000 1001 XPARMS JMP  DRAW
  4  0002 0000 PARM1  DATA 0
  5            
  6            DRAW
  7  0004 C0A0        MOV  @PARM1,R2
  7  0006 0002' 
  8  0008 045B        B    *R11
  9  000A 0000        END

------ Symbol Listing ------

DRAW   REL:0004 DRAW
PARM1  REL:0002 PARM1
XPARMS REL:0000 XPARMS

 

The first column in the listing is the address. The second column is the machine code for the instruction. Note that assembler "directives" and labels on lines by themselves do not cause the address to change since neither is executable code or data. The assembler always starts counting at address >0000 for relocatable code. The symbol table shows the addresses where the labels are located, and in this case they are RELative to the start of the code (as opposed to fixed memory locations.)

 

We can see from the listing that PARM1 is located at address >0002 if the code stared at address >0000. Any place in our code where PARM1 was used, is replaced with @>0002, like in the MOV instruction. The "tick mark" (') next to a word (look at address >0006) means that value needs to be "fixed up", which is the process of adding the load address to that value.

 

For example, lets say this code is loaded by XB's LOAD starting at address >2500 (low memory, just past the memory that CALL INIT uses). Remember, this code will not really be located in CPU RAM starting at address >0000 (which is impossible anyway since that address is in the console ROM.) But, when we are writing our program, the assembler does not know where the program will be loaded either, so all address references can only be determined when the program is actually loaded.

 

  1  2500 0000        DEF XPARMS,DRAW
  1  2500 0004  
  2            
  3  2500 1001 XPARMS JMP  DRAW
  4  2502 0000 PARM1  DATA 0
  5            
  6            DRAW
  7  2504 C0A0        MOV  @PARM1,R2
  7  2506 2502  
  8  2508 045B        B    *R11
  9  250A 0000        END

 

The loader will add >2500 to all the references that are designated as "relocatable". Now you can see PARM1 is actually at >2502, DRAW starts at >2504, and XPARMS is >2500. Again, remember that these addresses are not known until the code is loaded. The assembler simply says: "these labels are relative to the start of the code, which was set to >0000 at assembly time. If you want to move the code, just add your desired starting address to all the label references."

 

Now, since XPARMS and DRAW were in the DEF directive, the loader will also add REF/DEF entries for them. The R/D table is just a table of names and addresses. The "name" is whatever you put in the DEF, and the "address" is the memory location where that label now points. So, in this case, the address for XPARMS ended up being >2500, and DRAW is >2504. So, the first entry in the R/D table is for XPARMS:

 

REF/DEF table entry for the XPARMS label.  Each entry is 8 bytes.

Address | Byte value
>3FF8   | 88 (X)
>3FF9   | 80 (P)
>3FFA   | 65 (A)
>3FFB   | 82 (R)
>3FFC   | 77 (M)
>3FFD   | 83 (S)
>3FFE   | >25
>3FFF   | >00

 

The location of the R/D table is "fixed". In XB it will always start at >3FFF and grow "down" in memory for each entry. When you CALL LINK("XPARMS"), the LINK routine will look through the R/D table looking for a name that matches what you typed, when it finds a match it reads the address (last two bytes that make a 16-bit address) and branch to that memory location with BL.

 

So, we use all this to get access to the address of PARM1. We set things up so we know a few things:

 

1. XPARMS is the first entry in the R/D table. We know this because we placed it first in the DEF directive.

 

2. That the XB R/D table is always located starting at address >3FFF.

 

3. Each R/D entry is 8 bytes, the first six being the "name", the last two being the 16-bit address of that label.

 

4. PARM1 follows XPARMS in our code, and thus in memory.

 

5. The code at XPARMS is a JMP instruction which will take two bytes of memory, so PARM1 will be at an address two bytes greater than the address of XPARMS.

 

So, in XB we use LOAD to get the two address bytes in the R/D table for the XPARMS entry. So that address + 2 is the memory address where the PARM1 label resolved to during assembly and was "fixed up" to by the loader. So we then use LOAD to write two bytes at the PARM1 address, which makes a 16-bit value. The assembler replaced all references to PARM1 with the address it assigned that label, and the loader fixed up that address when it loaded our code.

 

Thus, the address used in our assembly code for PARM1 is the same address we are writing to from XB with the statement:

 

CALL LOAD(ADR,0,MAP)

 

It would probably be more clear if you just put PARM1 in the DEF directive. But anything you put in the DEF will be put in the R/D table, and thus you could use in CALL LINK. And if you tried to CALL LINK to PARM1, the CPU will try to execute the data at that memory location as if it were code, and that would probably result in a nice system crash or lock up. Putting a JMP instruction at the XPARMS label is just a fail-safe, but still lets us know where the PARM1 address is.

 

Is this making sense yet? By the way, you don't have to apologize to me for not being born with this knowledge. ;)

Edited by matthew180
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...