Jump to content
IGNORED

BASIC / XB Translator (TidBit)


matthew180

Recommended Posts

Alrighty... Took A TON of work wading through the 12" egg noodles, but VOILA!

 

Haven't tested or debugged... My eyes are bleeding.

 

 

 

Beryl Reichardt TIdBiT transfer workstation:
3/18/15
 
 
 
 
 
          // first  thing to do is call the link up to load the map data into memory
 
InitLoad-MapData: 
     CALL LDAT
 
 
PlayerStartup:
 
          // Give player a "place to start"
          // MX and MY are which map in the world are going to be drawn.  In this case, it's 1,1
          // PX&PY are the players' X location and Y location on the screen
          // SPX and SPY are the location of the SPRITE corresponding to the character position
 
     MX=1 :: MY=1
     PX=18 :: PY=8
     SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
 
 
          // These are party inventory... Starting with 100 gold, 4 health potions, 4 magic potions, 4 Elixirs, and zero scrolls
 
     GLD=100 :: HPO=4 :: MPO=4 :: ELI=4 :: SCR=0
 
 
          // These are repeated strings.  Currently there are only two, but there will be many more to come
 
     EX$="PRESS ENTER TO EXIT"
     BS$="BROADSWORD"
     EXU$="^^^^^^^^^^^^^^^^^^^"
 
 
 
 
          // These are Individual statistics for Beryl, Skylar, and Markus.  
          // MHP is max health power, HP is current health power
          // MMP is max magic power, MP is current magic power
          // DEF and ATK are the current stats for defense and attack
          // MDEF and MATK are max stats for defense and attack
 
     BMHP=20 :: BHP=15 :: BMMP=20 :: BMP=5 :: BDEF=10 :: BATK=10 :: BMDEF=7 :: BMATK=4
     RMHP=16 :: RHP=5 :: RMMP=40 :: RMP=20 :: RDEF=3 :: RATK=4 :: RMDEF=10 :: RMATK=12
     MMHP=25 :: MHP=18 :: MMMP=0 :: MMP=0 :: MDEF=15 :: MATK=15 :: MMDEF=5 :: MMATK=0
     SMHP=12 :: SHP=5 :: SMMP=20 :: SMP=12 :: SDEF=5 :: SATK=4 :: SMDEF=9 :: SMATK=8
 
          //These are the player "levels".  When the player level goes up, so will most of the maximum stats above.
 
     BLEV=1 :: RLEV=1 :: MLEV=1 :: SLEV=1
 
 
Setscreen:
 
          // set up screen and border for exploration routines
 
     CALL CLEAR
     CALL SCREEN(2) !black screen
 
     //Draw Exploration Screen//
 
DrawScreen:
 
     CALL HCHAR(9,1,101,32):: CALL HCHAR(24,1,101,32):: CALL VCHAR(9,1,97,16):: CALL VCHAR(9,32,97,16) !border around viewport
     CALL HCHAR(9,1,98):: CALL HCHAR(9,32,100):: CALL HCHAR(24,1,99):: CALL HCHAR(24,32,96) !corners
     CALL CHAR(42,"193DD9FFD91924C3"):: CALL COLOR(2,16,2) !CHAR(42) is the little character representation so far... may change soon
     GOSUB TopInfo
 
                ****BEGIN GAME LOOP****
TopGameLoop:
 
          // This is the very top of the game loop.
 
     CALL SETMAP(MX,MY)
     CALL SPRITE(#1,42,16,SPX,SPY)
 
MidGameLoop:
 
          // midpoint for returns from bottom of loop
          // displays the character on screen based on player position
 
     SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
     CALL LOCATE(#1,SPX,SPY)
 
 
 
MidgameLoop-Keyscan:
 
     GOSUB Keyscan
 
          //upon keypress, up down, left, right checking for tiles in the direction selected
          //must be a tile below (lower than)CHR$(104)  to allow motion
          //must add 2 to each column to compensate for the DISPLAY/GCHAR offset
 
     IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PX=PX-1 :: GOTO CheckBoundary
     IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PY=PY-1 :: GOTO CheckBoundary
     IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PY=PY+1 :: GOTO CheckBoundary
     IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PX=PX+1 :: GOTO CheckBoundary
 
          //If M is pressed, goto menu block, if space bar, goto examine block
 
     IF K=32 THEN GOSUB Examine
     IF K=77 THEN GOTO MainMenu
     GOTO MidgameLoop-Keyscan
 
 
CheckBoundary:
 
          // this determines the boundaries onscreen and sets the map to be drawn by assembly routine
          // PX, PY are the current player's position on the screen
          // MX, MY are the designations for which map will be drawn
 
 
     IF PX<11 THEN PX=22 :: MY=MY-1 :: GOTO CheckMap !if player walks off top of screen, place character on opposite side of screen
     IF PX>22 THEN PX=11 :: MY=MY+1 :: GOTO CheckMap !if player walks off bottom of screen, place character on opposite side of screen
     IF PY<1 THEN PY=28 :: MX=MX-1 :: GOTO CheckMap !if player walks off left of screen, place character on opposite side of screen
     IF PY>28 THEN PY=1 :: MX=MX+1 :: GOTO CheckMap !if player walks off right of screen, place character on opposite side of screen
     GOTO MidGameLoop
 
 
CheckMap:
 
     IF MX<1 THEN MX=1 ELSE IF MX>2 THEN MX=2
     IF MY<1 THEN MY=1 ELSE IF MY>6 THEN MY=6
     CALL DELSPRITE(#1)
     GOTO TopGameLoop
 
 
          //END GAME LOOP!!!!!!!!!!!!//
 
          ***SUBROUTINES BELOW***
 
 
 
 
          //BEGIN EXAMINE LOOP//
Examine:
 
     DISPLAY AT(1,1):" ":" ":" ":" ":" ":" ":" ":" "
     DISPLAY AT(1,1):"WHICH DIRECTION?";
 
ExamineKeyscan:
 
     GOSUB Keyscan
     IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: GOSUB ExamineCheck :: RETURN
     IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: GOSUB ExamineCheck :: RETURN
     IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: GOSUB ExamineCheck :: RETURN
     IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: GOSUB ExamineCheck :: RETURN
     GOTO ExamineKeyscan
 
ExamineCheck:
          //This is the "YES" or "correct tile, IS an item" bit
     IF Q=115 THEN IT$=BS$ :: GOTO ItemYesFlag
 
          //This is the "NO" or "incorrect tile, is not an item" bit
     DISPLAY AT(1,1):" " :: GOSUB TopInfo :: RETURN
 
ItemYesFlag:
     DISPLAY AT(1,1):"YOU FOUND A ";IT$;:"ADD TO INVENTORY? (Y/N)";
 
 
MidExamineLoop-Keyscan:
     GOSUB Keyscan
     IF K=89 THEN DISPLAY AT(1,1):" ":" " :: GOSUB TopInfo :: RETURN
     IF K=78 THEN DISPLAY AT(1,1):" ":" " :: GOSUB TopInfo :: RETURN
     GOTO MidExamineLoop-Keyscan
 
 
     //END EXAMINE LOOP//
 
 
 
 
 
          //BEGIN MENU LOOP//
MainMenu:          
REM  MENU
     CALL CLEAR :: CALL SCREEN(2):: CALL DELSPRITE(#1)
     CALL HCHAR(5,1,101,32):: CALL HCHAR(20,1,101,32):: CALL VCHAR(5,1,97,15):: CALL VCHAR(5,32,97,15)
     CALL HCHAR(5,1,98):: CALL HCHAR(5,32,100):: CALL HCHAR(20,1,99):: CALL HCHAR(20,32,96)
 
MainMenu-MiddleReturn:
 
     GOSUB ClearMenu :: GOSUB ReturnString
     DISPLAY AT(8,1):"1) ITEMS":"2) ARMOR":"3) WEAPONS":"4) SPELLS":"5) STATUS";
 
 
MidMenu-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN CALL CLEAR :: GOTO Drawscreen
     IF K>54 THEN GOTO MidMenu-Keyscan ELSE IF K<49 THEN GOTO MidMenu-Keyscan
     ON K-48 GOTO ItemMenu,ArmorMenu,WeaponsMenu,SpellsMenu,StatusMenu
 
 
          //Item Menu Block//
 
ItemMenu:
 
     REM ITEM MENU
     GOSUB ClearMenu
     DISPLAY AT(1,12):"ITEMS";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB ReturnString
     DISPLAY AT(8,1):"USE ON WHICH CHARACTER?";:"1) BERYL";:"2) REPTOSLICER";:"3) MARKUS";:"4) SKYLAR";
 
MidItem-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO ItemMenu
     IF K>52 THEN GOTO MidItem-Keyscan ELSE IF K<49 THEN GOTO MidItem-Keyscan
     ON K-48 GOSUB ItemBeryl,ItemRepto,ItemMarkus,ItemSkylar
     GOTO ItemMenu
 
 
 
          //ACN=name, ANSP=name starting point, ANL=name length//
 
ItemBeryl:
     REM BERYL
     AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ACN$="BERYL" :: ANSP=12 :: ANL=5
     GOSUB ItemMenu2
     BHP=AHP :: BMP=AMP :: RETURN
 
ItemRepto:
     REM REPTO 
     AMHP=RMHP :: AHP=RHP :: AMMP=RMMP :: AMP=RMP :: ACN$="REPTOSLICER" :: ANSP=9 :: ANL=11
     GOSUB ItemMenu2
     RHP=AHP :: RMP=AMP :: RETURN
 
ItemMarkus:
     REM MARKUS
     AMHP=MMHP :: AHP=MHP :: AMMP=MMMP :: AMP=MMP :: ACN$="MARKUS" :: ANSP=12 :: ANL=6
     GOSUB ItemMenu2
     MHP=AHP :: MMP=AMP :: RETURN
 
ItemSkylar:
     REM SKYLAR
     AMHP=SMHP :: AHP=SHP :: AMMP=SMMP :: AMP=SMP :: ACN$="SKYLAR" :: ANSP=12 :: ANL=6
     GOSUB ItemMenu2
     SHP=AHP:: SMP=AMP :: RETURN
 
 
     REM **THIS IS THE MEAT OF THE ITEM MENU CODE**
 
ItemMenu2:
 
 
     GOSUB ClearMenu :: DISPLAY AT(1,ANSP):ACN$;:: CALL HCHAR(2,ANSP+2,94,ANL)
     GOSUB ReturnString
 
ItemDisplay:
 
     DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;
     DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
 
MidItem2-Keyscan:
     GOSUB Keyscancan
     IF K=13 THEN GOTO ItemMenu
     IF K>51 THEN GOTO MidItem2-Keyscan ELSE IF K<49 THEN GOTO MidItem2-Keyscan
     ON K-48 GOSUB HealthPotion,MagicPotion,Elixir
     CALL SCREEN(16):: FOR I=1 TO 20 :: NEXT I :: CALL SCREEN(2)
     DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
     DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;:: FOR I=1 TO 400 :: NEXT I
     RETURN
 
 
          //Use HealthPotion//
 
HealthPotion:
 
     IF HPO<1 THEN CALL SOUND(30,440,1):: HPO=0 :: GOTO ItemDisplay
     HPO=HPO-1 :: AHP=AHP+10 :: IF AHP>AMHP THEN AHP=AMHP
     RETURN
 
          //Use MagicPotion//
 
MagicPotion:
 
     IF MPO<1 THEN CALL SOUND(30,440,1):: MPO=0 :: GOTO ItemDisplay
     MPO=MPO-1 :: AMP=AMP+10 :: IF AMP>AMMP THEN AMP=AMMP
     RETURN
 
          //Use Elixir//
 
Elixir:
 
     IF ELI<1 THEN CALL SOUND(30,440,1):: ELI=0 :: GOTO ItemDisplay
     ELI=ELI-1 :: AHP=AHP+5 :: IF AHP>AMHP THEN AHP=AMHP
     AMP=AMP+5 :: IF AMP>AMMP THEN AMP=AMMP
     RETURN
 
 
 
 
 
          //Armor Menu//
 
ArmorMenu:
     
     REM ARMOR MENU
     GOSUB ClearMenu :: DISPLAY AT(1,12):"ARMOR";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB ReturnString
 
MidArmor-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidArmor-Keyscan
     GOSUB ClearMenu
 
WeaponsMenu: 
 
     REM WEAPONS MENU
     GOSUB ClearMenu :: DISPLAY AT(1,11):"WEAPONS";:: DISPLAY AT(2,11):"^^^^^^^" :: GOSUB ReturnString
 
MidWeapons-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidWeapons-Keyscan
     GOSUB ClearMenu
 
SpellsMenu:
 
     REM SPELLS MENU
     GOSUB ClearMenu :: DISPLAY AT(1,12):"SPELLS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB ReturnString
 
MidSpells-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidSpells-Keyscan
     GOSUB ClearMenu
 
**************************
**** NEXT AREA OF WORK****
**************************
 
     //REM STATUS MENU//
     //REM THIS IS THE NEXT AREA OF FOCUS... GET WORKING STATUS MENU GOING BY LOADING THE "A" SET WITH CHAR'S INFO//
     //REM **USE THESE: ALEV=BLEV :: AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ADEF=BDEF :: AATK=BATK :: AMDEF=BMDEF//
     //REM **AMATK=BMATK :: ACN$="BERYL" :: ANSP=14 :: ANL=5//
 
StatusMenu:
 
     GOSUB ClearMenu :: DISPLAY AT(1,12):"STATUS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB ReturnString
 
MidStatus-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidStatus-Keyscan
     CALL CLEAR :: GOTO DrawScreen
 
          //ClearMenu//
ClearMenu:
 
     REM     CLEAR MENU INFO
     DISPLAY AT(8,1):" ":" ":" ":" ":" ":" " :: DISPLAY AT(1,1):" ":" ":" " :: DISPLAY AT(22,1):" ":" "
     RETURN
 
 
          //ReturnString//
 
ReturnString:
 
     REM MENU RETURN GAME STRING
     DISPLAY AT(22,5):EX$;:: DISPLAY AT(23,5):EXU$;
     RETURN
 
 
 
TopInfo: 
 
          //this displays all necessary information at the top of the screen during gameplay
 
 
     DISPLAY AT(1,9):"FORESTIA"
     DISPLAY AT(2,1):"BERYL":"HP:";BHP:"MP:";BMP :: DISPLAY AT(2,9):"^^^^^^^^";
     DISPLAY AT(2,18):"REPTOSLICER" :: DISPLAY AT(3,18):"HP:";RHP :: DISPLAY AT(4,18):"MP:";RMP
     DISPLAY AT(6,1):"SKYLAR":"HP:";SHP:"MP:";SMP
     DISPLAY AT(6,18):"MARKUS" :: DISPLAY AT(7,18):"HP:";MHP :: DISPLAY AT(8,18):"MP:";MMP
     RETURN
 
 
 
Keyscan:
 
     CALL KEY(0,K,S):: IF S=0 THEN Keyscan
     RETURN
 
 
          //SUB LDAT//
     REM       **SUB TO CALL THE ASSEMBLY ROUTINE TO LOAD MAP INTO MEMORY**
     SUB LDAT
     CALL INIT
     CALL LOAD("DSK1.NEWFORO")
     SUBEND
 
          //SUB SETMAP//
     REM       **SUB TO DRAW THE MAP ONSCREEN**
     SUB SETMAP(MX,MY)
     X=MX :: Y=MY
     IF ADR<>0 THEN MidSetmap-Check
     CALL PEEK(16382,P,Q)
     ADR=P*256+Q+2
 
MidSetmap-Check:
 
     Y=Y-1 :: MAP=Y*2+X
     IF MAP<1 OR MAP>12 THEN SUBEXIT
     CALL LOAD(ADR,0,MAP)
     CALL LINK("DRAW")
     SUBEND

 

 

Edited by Opry99er
  • Like 3
Link to comment
Share on other sites

Alright, for your viewing pleasure, a working, debugged TIdBiT source listing, and the exported XB code. I marked where bugs were fixed... There were only three. One was in "MidItem2-Keyscan" where I had misspelled a label, one was in "MidMenu-Keyscan" where case sensitivity of labels came into play, and the other was in "MidItem-Keyscan" where I had referenced an incorrect label that stuck me in an infinite loop.

 

It took about 15 minutes to debug, and now it's a working, playable demo with legible source that is easy to break down and edit.

 

 

Source IN: (No line numbers anywhere)

 

 

 

 
REM Beryl Reichardt TIdBiT transfer workstation:
REM 3/18/15
 
 
 
 
 
          // first  thing to do is call the link up to load the map data into memory
 
InitLoad-MapData: 
     CALL LDAT
 
 
PlayerStartup:
 
          // Give player a "place to start"
          // MX and MY are which map in the world are going to be drawn.  In this case, it's 1,1
          // PX&PY are the players' X location and Y location on the screen
          // SPX and SPY are the location of the SPRITE corresponding to the character position
 
     MX=1 :: MY=1
     PX=18 :: PY=8
     SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
 
 
          // These are party inventory... Starting with 100 gold, 4 health potions, 4 magic potions, 4 Elixirs, and zero scrolls
 
     GLD=100 :: HPO=4 :: MPO=4 :: ELI=4 :: SCR=0
 
 
          // These are repeated strings.  Currently there are only two, but there will be many more to come
 
     EX$="PRESS ENTER TO EXIT"
     BS$="BROADSWORD"
     EXU$="^^^^^^^^^^^^^^^^^^^"
 
 
 
 
          // These are Individual statistics for Beryl, Skylar, and Markus.  
          // MHP is max health power, HP is current health power
          // MMP is max magic power, MP is current magic power
          // DEF and ATK are the current stats for defense and attack
          // MDEF and MATK are max stats for defense and attack
 
     BMHP=20 :: BHP=15 :: BMMP=20 :: BMP=5 :: BDEF=10 :: BATK=10 :: BMDEF=7 :: BMATK=4
     RMHP=16 :: RHP=5 :: RMMP=40 :: RMP=20 :: RDEF=3 :: RATK=4 :: RMDEF=10 :: RMATK=12
     MMHP=25 :: MHP=18 :: MMMP=0 :: MMP=0 :: MDEF=15 :: MATK=15 :: MMDEF=5 :: MMATK=0
     SMHP=12 :: SHP=5 :: SMMP=20 :: SMP=12 :: SDEF=5 :: SATK=4 :: SMDEF=9 :: SMATK=8
 
          //These are the player "levels".  When the player level goes up, so will most of the maximum stats above.
 
     BLEV=1 :: RLEV=1 :: MLEV=1 :: SLEV=1
 
 
Setscreen:
 
          // set up screen and border for exploration routines
 
     CALL CLEAR
     CALL SCREEN(2) !black screen
 
     //Draw Exploration Screen//
 
DrawScreen:
 
     CALL HCHAR(9,1,101,32):: CALL HCHAR(24,1,101,32):: CALL VCHAR(9,1,97,16):: CALL VCHAR(9,32,97,16) !border around viewport
     CALL HCHAR(9,1,98):: CALL HCHAR(9,32,100):: CALL HCHAR(24,1,99):: CALL HCHAR(24,32,96) !corners
     CALL CHAR(42,"193DD9FFD91924C3"):: CALL COLOR(2,16,2) !CHAR(42) is the little character representation so far... may change soon
     GOSUB TopInfo
 
                ****BEGIN GAME LOOP****
TopGameLoop:
 
          // This is the very top of the game loop.
 
     CALL SETMAP(MX,MY)
     CALL SPRITE(#1,42,16,SPX,SPY)
 
MidGameLoop:
 
          // midpoint for returns from bottom of loop
          // displays the character on screen based on player position
 
     SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
     CALL LOCATE(#1,SPX,SPY)
 
 
 
MidgameLoop-Keyscan:
 
     GOSUB Keyscan
 
          //upon keypress, up down, left, right checking for tiles in the direction selected
          //must be a tile below (lower than)CHR$(104)  to allow motion
          //must add 2 to each column to compensate for the DISPLAY/GCHAR offset
 
     IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PX=PX-1 :: GOTO CheckBoundary
     IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PY=PY-1 :: GOTO CheckBoundary
     IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PY=PY+1 :: GOTO CheckBoundary
     IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PX=PX+1 :: GOTO CheckBoundary
 
          //If M is pressed, goto menu block, if space bar, goto examine block
 
     IF K=32 THEN GOSUB Examine
     IF K=77 THEN GOTO MainMenu
     GOTO MidgameLoop-Keyscan
 
 
CheckBoundary:
 
          // this determines the boundaries onscreen and sets the map to be drawn by assembly routine
          // PX, PY are the current player's position on the screen
          // MX, MY are the designations for which map will be drawn
 
 
     IF PX<11 THEN PX=22 :: MY=MY-1 :: GOTO CheckMap !if player walks off top of screen, place character on opposite side of screen
     IF PX>22 THEN PX=11 :: MY=MY+1 :: GOTO CheckMap !if player walks off bottom of screen, place character on opposite side of screen
     IF PY<1 THEN PY=28 :: MX=MX-1 :: GOTO CheckMap !if player walks off left of screen, place character on opposite side of screen
     IF PY>28 THEN PY=1 :: MX=MX+1 :: GOTO CheckMap !if player walks off right of screen, place character on opposite side of screen
     GOTO MidGameLoop
 
 
CheckMap:
 
     IF MX<1 THEN MX=1 ELSE IF MX>2 THEN MX=2
     IF MY<1 THEN MY=1 ELSE IF MY>6 THEN MY=6
     CALL DELSPRITE(#1)
     GOTO TopGameLoop
 
 
          //END GAME LOOP!!!!!!!!!!!!//
 
          ***SUBROUTINES BELOW***
 
 
 
 
          //BEGIN EXAMINE LOOP//
Examine:
 
     DISPLAY AT(1,1):" ":" ":" ":" ":" ":" ":" ":" "
     DISPLAY AT(1,1):"WHICH DIRECTION?";
 
ExamineKeyscan:
 
     GOSUB Keyscan
     IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: GOSUB ExamineCheck :: RETURN
     IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: GOSUB ExamineCheck :: RETURN
     IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: GOSUB ExamineCheck :: RETURN
     IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: GOSUB ExamineCheck :: RETURN
     GOTO ExamineKeyscan
 
ExamineCheck:
          //This is the "YES" or "correct tile, IS an item" bit
     IF Q=115 THEN IT$=BS$ :: GOTO ItemYesFlag
 
          //This is the "NO" or "incorrect tile, is not an item" bit
     DISPLAY AT(1,1):" " :: GOSUB TopInfo :: RETURN
 
ItemYesFlag:
     DISPLAY AT(1,1):"YOU FOUND A ";IT$;:"ADD TO INVENTORY? (Y/N)";
 
 
MidExamineLoop-Keyscan:
     GOSUB Keyscan
     IF K=89 THEN DISPLAY AT(1,1):" ":" " :: GOSUB TopInfo :: RETURN
     IF K=78 THEN DISPLAY AT(1,1):" ":" " :: GOSUB TopInfo :: RETURN
     GOTO MidExamineLoop-Keyscan
 
 
     //END EXAMINE LOOP//
 
 
 
 
 
          //BEGIN MENU LOOP//
MainMenu:          
REM  MENU
     CALL CLEAR :: CALL SCREEN(2):: CALL DELSPRITE(#1)
     CALL HCHAR(5,1,101,32):: CALL HCHAR(20,1,101,32):: CALL VCHAR(5,1,97,15):: CALL VCHAR(5,32,97,15)
     CALL HCHAR(5,1,98):: CALL HCHAR(5,32,100):: CALL HCHAR(20,1,99):: CALL HCHAR(20,32,96)
 
MainMenu-MiddleReturn:
 
     GOSUB ClearMenu :: GOSUB ReturnString
     DISPLAY AT(8,1):"1) ITEMS":"2) ARMOR":"3) WEAPONS":"4) SPELLS":"5) STATUS";
 
 
MidMenu-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN CALL CLEAR :: GOTO DrawScreen !**BUG FIXED HERE** Case-sensitive labels
     IF K>54 THEN GOTO MidMenu-Keyscan ELSE IF K<49 THEN GOTO MidMenu-Keyscan
     ON K-48 GOTO ItemMenu,ArmorMenu,WeaponsMenu,SpellsMenu,StatusMenu
 
 
          //Item Menu Block//
 
ItemMenu:
 
     REM ITEM MENU
     GOSUB ClearMenu
     DISPLAY AT(1,12):"ITEMS";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB ReturnString
     DISPLAY AT(8,1):"USE ON WHICH CHARACTER?";:"1) BERYL";:"2) REPTOSLICER";:"3) MARKUS";:"4) SKYLAR";
 
MidItem-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn !**BUG FIXED---incorrect label here, did not allow return to Main Menu
     IF K>52 THEN GOTO MidItem-Keyscan ELSE IF K<49 THEN GOTO MidItem-Keyscan
     ON K-48 GOSUB ItemBeryl,ItemRepto,ItemMarkus,ItemSkylar
     GOTO ItemMenu
 
 
 
          //ACN=name, ANSP=name starting point, ANL=name length//
 
ItemBeryl:
     REM BERYL
     AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ACN$="BERYL" :: ANSP=12 :: ANL=5
     GOSUB ItemMenu2
     BHP=AHP :: BMP=AMP :: RETURN
 
ItemRepto:
     REM REPTO 
     AMHP=RMHP :: AHP=RHP :: AMMP=RMMP :: AMP=RMP :: ACN$="REPTOSLICER" :: ANSP=9 :: ANL=11
     GOSUB ItemMenu2
     RHP=AHP :: RMP=AMP :: RETURN
 
ItemMarkus:
     REM MARKUS
     AMHP=MMHP :: AHP=MHP :: AMMP=MMMP :: AMP=MMP :: ACN$="MARKUS" :: ANSP=12 :: ANL=6
     GOSUB ItemMenu2
     MHP=AHP :: MMP=AMP :: RETURN
 
ItemSkylar:
     REM SKYLAR
     AMHP=SMHP :: AHP=SHP :: AMMP=SMMP :: AMP=SMP :: ACN$="SKYLAR" :: ANSP=12 :: ANL=6
     GOSUB ItemMenu2
     SHP=AHP:: SMP=AMP :: RETURN
 
 
     REM **THIS IS THE MEAT OF THE ITEM MENU CODE**
 
ItemMenu2:
 
 
     GOSUB ClearMenu :: DISPLAY AT(1,ANSP):ACN$;:: CALL HCHAR(2,ANSP+2,94,ANL)
     GOSUB ReturnString
 
ItemDisplay:
 
     DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;
     DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
 
MidItem2-Keyscan:
     GOSUB Keyscan !***BUG FIXED HERE*** Spelled, "Keyscancan"
     IF K=13 THEN GOTO ItemMenu
     IF K>51 THEN GOTO MidItem2-Keyscan ELSE IF K<49 THEN GOTO MidItem2-Keyscan
     ON K-48 GOSUB HealthPotion,MagicPotion,Elixir
     CALL SCREEN(16):: FOR I=1 TO 20 :: NEXT I :: CALL SCREEN(2)
     DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
     DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;:: FOR I=1 TO 400 :: NEXT I
     RETURN
 
 
          //Use HealthPotion//
 
HealthPotion:
 
     IF HPO<1 THEN CALL SOUND(30,440,1):: HPO=0 :: GOTO ItemDisplay
     HPO=HPO-1 :: AHP=AHP+10 :: IF AHP>AMHP THEN AHP=AMHP
     RETURN
 
          //Use MagicPotion//
 
MagicPotion:
 
     IF MPO<1 THEN CALL SOUND(30,440,1):: MPO=0 :: GOTO ItemDisplay
     MPO=MPO-1 :: AMP=AMP+10 :: IF AMP>AMMP THEN AMP=AMMP
     RETURN
 
          //Use Elixir//
 
Elixir:
 
     IF ELI<1 THEN CALL SOUND(30,440,1):: ELI=0 :: GOTO ItemDisplay
     ELI=ELI-1 :: AHP=AHP+5 :: IF AHP>AMHP THEN AHP=AMHP
     AMP=AMP+5 :: IF AMP>AMMP THEN AMP=AMMP
     RETURN
 
 
 
 
 
          //Armor Menu//
 
ArmorMenu:
     
     REM ARMOR MENU
     GOSUB ClearMenu :: DISPLAY AT(1,12):"ARMOR";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB ReturnString
 
MidArmor-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidArmor-Keyscan
     GOSUB ClearMenu
 
WeaponsMenu: 
 
     REM WEAPONS MENU
     GOSUB ClearMenu :: DISPLAY AT(1,11):"WEAPONS";:: DISPLAY AT(2,11):"^^^^^^^" :: GOSUB ReturnString
 
MidWeapons-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidWeapons-Keyscan
     GOSUB ClearMenu
 
SpellsMenu:
 
     REM SPELLS MENU
     GOSUB ClearMenu :: DISPLAY AT(1,12):"SPELLS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB ReturnString
 
MidSpells-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidSpells-Keyscan
     GOSUB ClearMenu
 
**************************
**** NEXT AREA OF WORK****
**************************
 
     //REM STATUS MENU//
     //REM THIS IS THE NEXT AREA OF FOCUS... GET WORKING STATUS MENU GOING BY LOADING THE "A" SET WITH CHAR'S INFO//
     //REM **USE THESE: ALEV=BLEV :: AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ADEF=BDEF :: AATK=BATK :: AMDEF=BMDEF//
     //REM **AMATK=BMATK :: ACN$="BERYL" :: ANSP=14 :: ANL=5//
 
StatusMenu:
 
     GOSUB ClearMenu :: DISPLAY AT(1,12):"STATUS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB ReturnString
 
MidStatus-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidStatus-Keyscan
     CALL CLEAR :: GOTO DrawScreen
 
          //ClearMenu//
ClearMenu:
 
     REM     CLEAR MENU INFO
     DISPLAY AT(8,1):" ":" ":" ":" ":" ":" " :: DISPLAY AT(1,1):" ":" ":" " :: DISPLAY AT(22,1):" ":" "
     RETURN
 
 
          //ReturnString//
 
ReturnString:
 
     REM MENU RETURN GAME STRING
     DISPLAY AT(22,5):EX$;:: DISPLAY AT(23,5):EXU$;
     RETURN
 
 
 
TopInfo: 
 
          //this displays all necessary information at the top of the screen during gameplay
 
 
     DISPLAY AT(1,9):"FORESTIA"
     DISPLAY AT(2,1):"BERYL":"HP:";BHP:"MP:";BMP :: DISPLAY AT(2,9):"^^^^^^^^";
     DISPLAY AT(2,18):"REPTOSLICER" :: DISPLAY AT(3,18):"HP:";RHP :: DISPLAY AT(4,18):"MP:";RMP
     DISPLAY AT(6,1):"SKYLAR":"HP:";SHP:"MP:";SMP
     DISPLAY AT(6,18):"MARKUS" :: DISPLAY AT(7,18):"HP:";MHP :: DISPLAY AT(8,18):"MP:";MMP
     RETURN
 
 
 
Keyscan:
 
     CALL KEY(0,K,S):: IF S=0 THEN Keyscan
     RETURN
 
 
          //SUB LDAT//
     REM       **SUB TO CALL THE ASSEMBLY ROUTINE TO LOAD MAP INTO MEMORY**
     SUB LDAT
     CALL INIT
     CALL LOAD("DSK1.NEWFORO")
     SUBEND
 
          //SUB SETMAP//
     REM       **SUB TO DRAW THE MAP ONSCREEN**
     SUB SETMAP(MX,MY)
     X=MX :: Y=MY
     IF ADR<>0 THEN MidSetmap-Check
     CALL PEEK(16382,P,Q)
     ADR=P*256+Q+2
 
MidSetmap-Check:
 
     Y=Y-1 :: MAP=Y*2+X
     IF MAP<1 OR MAP>12 THEN SUBEXIT
     CALL LOAD(ADR,0,MAP)
     CALL LINK("DRAW")
     SUBEND
 

XB Out:

 

100 REM Beryl Reichardt TIdBiT transfer workstation:
110 REM 3/18/15
120 CALL LDAT
130 MX=1 :: MY=1
140 PX=18 :: PY=8
150 SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
160 GLD=100 :: HPO=4 :: MPO=4 :: ELI=4 :: SCR=0
170 EX$="PRESS ENTER TO EXIT"
180 BS$="BROADSWORD"
190 EXU$="^^^^^^^^^^^^^^^^^^^"
200 BMHP=20 :: BHP=15 :: BMMP=20 :: BMP=5 :: BDEF=10 :: BATK=10 :: BMDEF=7 :: BMATK=4
210 RMHP=16 :: RHP=5 :: RMMP=40 :: RMP=20 :: RDEF=3 :: RATK=4 :: RMDEF=10 :: RMATK=12
220 MMHP=25 :: MHP=18 :: MMMP=0 :: MMP=0 :: MDEF=15 :: MATK=15 :: MMDEF=5 :: MMATK=0
230 SMHP=12 :: SHP=5 :: SMMP=20 :: SMP=12 :: SDEF=5 :: SATK=4 :: SMDEF=9 :: SMATK=8
240 BLEV=1 :: RLEV=1 :: MLEV=1 :: SLEV=1
250 CALL CLEAR
260 CALL SCREEN(2) !black screen
270 CALL HCHAR(9,1,101,32):: CALL HCHAR(24,1,101,32):: CALL VCHAR(9,1,97,16):: CALL VCHAR(9,32,97,16) !border around viewport
280 CALL HCHAR(9,1,98):: CALL HCHAR(9,32,100):: CALL HCHAR(24,1,99):: CALL HCHAR(24,32,96) !corners
290 CALL CHAR(42,"193DD9FFD91924C3"):: CALL COLOR(2,16,2) !CHAR(42) is the little character representation so far... may change soon
300 GOSUB 1550
310 ****BEGIN GAME LOOP****
320 CALL SETMAP(MX,MY)
330 CALL SPRITE(#1,42,16,SPX,SPY)
340 SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
350 CALL LOCATE(#1,SPX,SPY)
360 GOSUB 1610
370 IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: IF Q>104 THEN GOTO 360 ELSE PX=PX-1 :: GOTO 440
380 IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: IF Q>104 THEN GOTO 360 ELSE PY=PY-1 :: GOTO 440
390 IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: IF Q>104 THEN GOTO 360 ELSE PY=PY+1 :: GOTO 440
400 IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: IF Q>104 THEN GOTO 360 ELSE PX=PX+1 :: GOTO 440
410 IF K=32 THEN GOSUB 540
420 IF K=77 THEN GOTO 690
430 GOTO 360
440 IF PX<11 THEN PX=22 :: MY=MY-1 :: GOTO 490 !if player walks off top of screen, place character on opposite side of screen
450 IF PX>22 THEN PX=11 :: MY=MY+1 :: GOTO 490 !if player walks off bottom of screen, place character on opposite side of screen
460 IF PY<1 THEN PY=28 :: MX=MX-1 :: GOTO 490 !if player walks off left of screen, place character on opposite side of screen
470 IF PY>28 THEN PY=1 :: MX=MX+1 :: GOTO 490 !if player walks off right of screen, place character on opposite side of screen
480 GOTO 340
490 IF MX<1 THEN MX=1 ELSE IF MX>2 THEN MX=2
500 IF MY<1 THEN MY=1 ELSE IF MY>6 THEN MY=6
510 CALL DELSPRITE(#1)
520 GOTO 320
530 ***SUBROUTINES BELOW***
540 DISPLAY AT(1,1):" ":" ":" ":" ":" ":" ":" ":" "
550 DISPLAY AT(1,1):"WHICH DIRECTION?";
560 GOSUB 1610
570 IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: GOSUB 620 :: RETURN
580 IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: GOSUB 620 :: RETURN
590 IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: GOSUB 620 :: RETURN
600 IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: GOSUB 620 :: RETURN
610 GOTO 560
620 IF Q=115 THEN IT$=BS$ :: GOTO 640
630 DISPLAY AT(1,1):" " :: GOSUB 1550 :: RETURN
640 DISPLAY AT(1,1):"YOU FOUND A ";IT$;:"ADD TO INVENTORY? (Y/N)";
650 GOSUB 1610
660 IF K=89 THEN DISPLAY AT(1,1):" ":" " :: GOSUB 1550 :: RETURN
670 IF K=78 THEN DISPLAY AT(1,1):" ":" " :: GOSUB 1550 :: RETURN
680 GOTO 650
690 REM  MENU
700 CALL CLEAR :: CALL SCREEN(2):: CALL DELSPRITE(#1)
710 CALL HCHAR(5,1,101,32):: CALL HCHAR(20,1,101,32):: CALL VCHAR(5,1,97,15):: CALL VCHAR(5,32,97,15)
720 CALL HCHAR(5,1,98):: CALL HCHAR(5,32,100):: CALL HCHAR(20,1,99):: CALL HCHAR(20,32,96)
730 GOSUB 1490 :: GOSUB 1520
740 DISPLAY AT(8,1):"1) ITEMS":"2) ARMOR":"3) WEAPONS":"4) SPELLS":"5) STATUS";
750 GOSUB 1610
760 IF K=13 THEN CALL CLEAR :: GOTO 270 !**BUG FIXED HERE** Case-sensitive labels
770 IF K>54 THEN GOTO 750 ELSE IF K<49 THEN GOTO 750
780 ON K-48 GOTO 790,1270,1320,1370,1450
790 REM ITEM MENU
800 GOSUB 1490
810 DISPLAY AT(1,12):"ITEMS";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB 1520
820 DISPLAY AT(8,1):"USE ON WHICH CHARACTER?";:"1) BERYL";:"2) REPTOSLICER";:"3) MARKUS";:"4) SKYLAR";
830 GOSUB 1610
840 IF K=13 THEN GOTO 730 !**BUG FIXED---incorrect label here, did not allow return to Main Menu
850 IF K>52 THEN GOTO 830 ELSE IF K<49 THEN GOTO 830
860 ON K-48 GOSUB 880,920,960,1000
870 GOTO 790
880 REM BERYL
890 AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ACN$="BERYL" :: ANSP=12 :: ANL=5
900 GOSUB 1050
910 BHP=AHP :: BMP=AMP :: RETURN
920 REM REPTO
930 AMHP=RMHP :: AHP=RHP :: AMMP=RMMP :: AMP=RMP :: ACN$="REPTOSLICER" :: ANSP=9 :: ANL=11
940 GOSUB 1050
950 RHP=AHP :: RMP=AMP :: RETURN
960 REM MARKUS
970 AMHP=MMHP :: AHP=MHP :: AMMP=MMMP :: AMP=MMP :: ACN$="MARKUS" :: ANSP=12 :: ANL=6
980 GOSUB 1050
990 MHP=AHP :: MMP=AMP :: RETURN
1000 REM SKYLAR
1010 AMHP=SMHP :: AHP=SHP :: AMMP=SMMP :: AMP=SMP :: ACN$="SKYLAR" :: ANSP=12 :: ANL=6
1020 GOSUB 1050
1030 SHP=AHP:: SMP=AMP :: RETURN
1040 REM **THIS IS THE MEAT OF THE ITEM MENU CODE**
1050 GOSUB 1490 :: DISPLAY AT(1,ANSP):ACN$;:: CALL HCHAR(2,ANSP+2,94,ANL)
1060 GOSUB 1520
1070 DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;
1080 DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
1090 GOSUB 1610
1100 IF K=13 THEN GOTO 790
1110 IF K>51 THEN GOTO 1090 ELSE IF K<49 THEN GOTO 1090
1120 ON K-48 GOSUB 1170,1200,1230
1130 CALL SCREEN(16):: FOR I=1 TO 20 :: NEXT I :: CALL SCREEN(2)
1140 DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
1150 DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;:: FOR I=1 TO 400 :: NEXT I
1160 RETURN
1170 IF HPO<1 THEN CALL SOUND(30,440,1):: HPO=0 :: GOTO 1070
1180 HPO=HPO-1 :: AHP=AHP+10 :: IF AHP>AMHP THEN AHP=AMHP
1190 RETURN
1200 IF MPO<1 THEN CALL SOUND(30,440,1):: MPO=0 :: GOTO 1070
1210 MPO=MPO-1 :: AMP=AMP+10 :: IF AMP>AMMP THEN AMP=AMMP
1220 RETURN
1230 IF ELI<1 THEN CALL SOUND(30,440,1):: ELI=0 :: GOTO 1070
1240 ELI=ELI-1 :: AHP=AHP+5 :: IF AHP>AMHP THEN AHP=AMHP
1250 AMP=AMP+5 :: IF AMP>AMMP THEN AMP=AMMP
1260 RETURN
1270 REM ARMOR MENU
1280 GOSUB 1490 :: DISPLAY AT(1,12):"ARMOR";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB 1520
1290 GOSUB 1610
1300 IF K=13 THEN GOTO 730 ELSE 1290
1310 GOSUB 1490
1320 REM WEAPONS MENU
1330 GOSUB 1490 :: DISPLAY AT(1,11):"WEAPONS";:: DISPLAY AT(2,11):"^^^^^^^" :: GOSUB 1520
1340 GOSUB 1610
1350 IF K=13 THEN GOTO 730 ELSE 1340
1360 GOSUB 1490
1370 REM SPELLS MENU
1380 GOSUB 1490 :: DISPLAY AT(1,12):"SPELLS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB 1520
1390 GOSUB 1610
1400 IF K=13 THEN GOTO 730 ELSE 1390
1410 GOSUB 1490
1420 **************************
1430 **** NEXT AREA OF WORK****
1440 **************************
1450 GOSUB 1490 :: DISPLAY AT(1,12):"STATUS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB 1520
1460 GOSUB 1610
1470 IF K=13 THEN GOTO 730 ELSE 1460
1480 CALL CLEAR :: GOTO 270
1490 REM     CLEAR MENU INFO
1500 DISPLAY AT(8,1):" ":" ":" ":" ":" ":" " :: DISPLAY AT(1,1):" ":" ":" " :: DISPLAY AT(22,1):" ":" "
1510 RETURN
1520 REM MENU RETURN GAME STRING
1530 DISPLAY AT(22,5):EX$;:: DISPLAY AT(23,5):EXU$;
1540 RETURN
1550 DISPLAY AT(1,9):"FORESTIA"
1560 DISPLAY AT(2,1):"BERYL":"HP:";BHP:"MP:";BMP :: DISPLAY AT(2,9):"^^^^^^^^";
1570 DISPLAY AT(2,18):"REPTOSLICER" :: DISPLAY AT(3,18):"HP:";RHP :: DISPLAY AT(4,18):"MP:";RMP
1580 DISPLAY AT(6,1):"SKYLAR":"HP:";SHP:"MP:";SMP
1590 DISPLAY AT(6,18):"MARKUS" :: DISPLAY AT(7,18):"HP:";MHP :: DISPLAY AT(8,18):"MP:";MMP
1600 RETURN
1610 CALL KEY(0,K,S):: IF S=0 THEN 1610
1620 RETURN
1630 REM       **SUB TO CALL THE ASSEMBLY ROUTINE TO LOAD MAP INTO MEMORY**
1640 SUB LDAT
1650 CALL INIT
1660 CALL LOAD("DSK1.NEWFORO")
1670 SUBEND
1680 REM       **SUB TO DRAW THE MAP ONSCREEN**
1690 SUB SETMAP(MX,MY)
1700 X=MX :: Y=MY
1710 IF ADR<>0 THEN 1740
1720 CALL PEEK(16382,P,Q)
1730 ADR=P*256+Q+2
1740 Y=Y-1 :: MAP=Y*2+X
1750 IF MAP<1 OR MAP>12 THEN SUBEXIT
1760 CALL LOAD(ADR,0,MAP)
1770 CALL LINK("DRAW")
1780 SUBEND
 

 

 

 

This has been really cool to work on. Thanks for the help, fellas. Now I have completed all the house-cleaning I needed to get done on my code AND THEN SOME....

 

On with the plan now.... Time to finish up the under-the-hood stuff so I can get on with the game development. The maps require work, as will some of the code handling the exploration routine... but that's all easy now.

 

It's no different than the last demo, really, but I'm posting a zipfile including a DSK1 of the game as is, as well as my TIdBiT source file in Notepad++ AND THE ORIGINAL XB code in Notepad++ so that you can really see the "before" and "after" of the conversion.

GameConversion.zip

  • Like 3
Link to comment
Share on other sites

I see it's Python based ... hey, if there are any plans to make it output to a readable .DSK image that means I can develop on linux for the TI a lot easier, as well as windows.

 

What is Python based? TidBit is written in PHP and the parser strips all leading and trailing white-space and does not pay attention to any indentation. I also provide the converter on my website so you can try it now without having to set anything up.

  • Like 1
Link to comment
Share on other sites

Line 310 is a syntax error for Extended Basic, although you do not reach that line. Could you possibly add a "!" at the beginning to make it a proper comment?

 

TidBit retains the ! comments in the output, which take up real memory on the 99/4A. Unless the comments are needed in the resulting output code, IMO you should convert them to // style comments so they are completely removed from the output.

Link to comment
Share on other sites

In my old code, I would just paste everything into Classic99,non-numbered comments included. It would just reject anything without a line number, so it basically stripped the code for me. I forget that TIdBiT functions as an interpreter and will assign line numbers to everything that isnt a label or designated comment. I missed that one. :)

Link to comment
Share on other sites

Michael,

 

Here is the updated listing with lines 310, 530, 1420,1430, and 1440 removed. This listing should give no errors in XB and should run flawlessly. All I did was update the source to create true TIdBiT comments out of my ***BEGIN LOOP*** mumbo jumbo, eliminating them from the exported XB code listing.

 

Below that, the updated source.

 

 

Updated XB code, minus Erroneous lines:

 

 

 

100 REM Beryl Reichardt TIdBiT transfer workstation:
110 REM 3/18/15
120 CALL LDAT
130 MX=1 :: MY=1
140 PX=18 :: PY=8
150 SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
160 GLD=100 :: HPO=4 :: MPO=4 :: ELI=4 :: SCR=0
170 EX$="PRESS ENTER TO EXIT"
180 BS$="BROADSWORD"
190 EXU$="^^^^^^^^^^^^^^^^^^^"
200 BMHP=20 :: BHP=15 :: BMMP=20 :: BMP=5 :: BDEF=10 :: BATK=10 :: BMDEF=7 :: BMATK=4
210 RMHP=16 :: RHP=5 :: RMMP=40 :: RMP=20 :: RDEF=3 :: RATK=4 :: RMDEF=10 :: RMATK=12
220 MMHP=25 :: MHP=18 :: MMMP=0 :: MMP=0 :: MDEF=15 :: MATK=15 :: MMDEF=5 :: MMATK=0
230 SMHP=12 :: SHP=5 :: SMMP=20 :: SMP=12 :: SDEF=5 :: SATK=4 :: SMDEF=9 :: SMATK=8
240 BLEV=1 :: RLEV=1 :: MLEV=1 :: SLEV=1
250 CALL CLEAR
260 CALL SCREEN(2) !black screen
270 CALL HCHAR(9,1,101,32):: CALL HCHAR(24,1,101,32):: CALL VCHAR(9,1,97,16):: CALL VCHAR(9,32,97,16) !border around viewport
280 CALL HCHAR(9,1,98):: CALL HCHAR(9,32,100):: CALL HCHAR(24,1,99):: CALL HCHAR(24,32,96) !corners
290 CALL CHAR(42,"193DD9FFD91924C3"):: CALL COLOR(2,16,2) !CHAR(42) is the little character representation so far... may change soon
300 GOSUB 1500
310 CALL SETMAP(MX,MY)
320 CALL SPRITE(#1,42,16,SPX,SPY)
330 SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
340 CALL LOCATE(#1,SPX,SPY)
350 GOSUB 1560
360 IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: IF Q>104 THEN GOTO 350 ELSE PX=PX-1 :: GOTO 430
370 IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: IF Q>104 THEN GOTO 350 ELSE PY=PY-1 :: GOTO 430
380 IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: IF Q>104 THEN GOTO 350 ELSE PY=PY+1 :: GOTO 430
390 IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: IF Q>104 THEN GOTO 350 ELSE PX=PX+1 :: GOTO 430
400 IF K=32 THEN GOSUB 520
410 IF K=77 THEN GOTO 670
420 GOTO 350
430 IF PX<11 THEN PX=22 :: MY=MY-1 :: GOTO 480 !if player walks off top of screen, place character on opposite side of screen
440 IF PX>22 THEN PX=11 :: MY=MY+1 :: GOTO 480 !if player walks off bottom of screen, place character on opposite side of screen
450 IF PY<1 THEN PY=28 :: MX=MX-1 :: GOTO 480 !if player walks off left of screen, place character on opposite side of screen
460 IF PY>28 THEN PY=1 :: MX=MX+1 :: GOTO 480 !if player walks off right of screen, place character on opposite side of screen
470 GOTO 330
480 IF MX<1 THEN MX=1 ELSE IF MX>2 THEN MX=2
490 IF MY<1 THEN MY=1 ELSE IF MY>6 THEN MY=6
500 CALL DELSPRITE(#1)
510 GOTO 310
520 DISPLAY AT(1,1):" ":" ":" ":" ":" ":" ":" ":" "
530 DISPLAY AT(1,1):"WHICH DIRECTION?";
540 GOSUB 1560
550 IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: GOSUB 600 :: RETURN
560 IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: GOSUB 600 :: RETURN
570 IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: GOSUB 600 :: RETURN
580 IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: GOSUB 600 :: RETURN
590 GOTO 540
600 IF Q=115 THEN IT$=BS$ :: GOTO 620
610 DISPLAY AT(1,1):" " :: GOSUB 1500 :: RETURN
620 DISPLAY AT(1,1):"YOU FOUND A ";IT$;:"ADD TO INVENTORY? (Y/N)";
630 GOSUB 1560
640 IF K=89 THEN DISPLAY AT(1,1):" ":" " :: GOSUB 1500 :: RETURN
650 IF K=78 THEN DISPLAY AT(1,1):" ":" " :: GOSUB 1500 :: RETURN
660 GOTO 630
670 REM  MENU
680 CALL CLEAR :: CALL SCREEN(2):: CALL DELSPRITE(#1)
690 CALL HCHAR(5,1,101,32):: CALL HCHAR(20,1,101,32):: CALL VCHAR(5,1,97,15):: CALL VCHAR(5,32,97,15)
700 CALL HCHAR(5,1,98):: CALL HCHAR(5,32,100):: CALL HCHAR(20,1,99):: CALL HCHAR(20,32,96)
710 GOSUB 1440 :: GOSUB 1470
720 DISPLAY AT(8,1):"1) ITEMS":"2) ARMOR":"3) WEAPONS":"4) SPELLS":"5) STATUS";
730 GOSUB 1560
740 IF K=13 THEN CALL CLEAR :: GOTO 270 !**BUG FIXED HERE** Case-sensitive labels
750 IF K>54 THEN GOTO 730 ELSE IF K<49 THEN GOTO 730
760 ON K-48 GOTO 770,1250,1300,1350,1400
770 REM ITEM MENU
780 GOSUB 1440
790 DISPLAY AT(1,12):"ITEMS";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB 1470
800 DISPLAY AT(8,1):"USE ON WHICH CHARACTER?";:"1) BERYL";:"2) REPTOSLICER";:"3) MARKUS";:"4) SKYLAR";
810 GOSUB 1560
820 IF K=13 THEN GOTO 710 !**BUG FIXED---incorrect label here, did not allow return to Main Menu
830 IF K>52 THEN GOTO 810 ELSE IF K<49 THEN GOTO 810
840 ON K-48 GOSUB 860,900,940,980
850 GOTO 770
860 REM BERYL
870 AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ACN$="BERYL" :: ANSP=12 :: ANL=5
880 GOSUB 1030
890 BHP=AHP :: BMP=AMP :: RETURN
900 REM REPTO
910 AMHP=RMHP :: AHP=RHP :: AMMP=RMMP :: AMP=RMP :: ACN$="REPTOSLICER" :: ANSP=9 :: ANL=11
920 GOSUB 1030
930 RHP=AHP :: RMP=AMP :: RETURN
940 REM MARKUS
950 AMHP=MMHP :: AHP=MHP :: AMMP=MMMP :: AMP=MMP :: ACN$="MARKUS" :: ANSP=12 :: ANL=6
960 GOSUB 1030
970 MHP=AHP :: MMP=AMP :: RETURN
980 REM SKYLAR
990 AMHP=SMHP :: AHP=SHP :: AMMP=SMMP :: AMP=SMP :: ACN$="SKYLAR" :: ANSP=12 :: ANL=6
1000 GOSUB 1030
1010 SHP=AHP:: SMP=AMP :: RETURN
1020 REM **THIS IS THE MEAT OF THE ITEM MENU CODE**
1030 GOSUB 1440 :: DISPLAY AT(1,ANSP):ACN$;:: CALL HCHAR(2,ANSP+2,94,ANL)
1040 GOSUB 1470
1050 DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;
1060 DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
1070 GOSUB 1560 !***BUG FIXED HERE*** Spelled, "Keyscancan"
1080 IF K=13 THEN GOTO 770
1090 IF K>51 THEN GOTO 1070 ELSE IF K<49 THEN GOTO 1070
1100 ON K-48 GOSUB 1150,1180,1210
1110 CALL SCREEN(16):: FOR I=1 TO 20 :: NEXT I :: CALL SCREEN(2)
1120 DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
1130 DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;:: FOR I=1 TO 400 :: NEXT I
1140 RETURN
1150 IF HPO<1 THEN CALL SOUND(30,440,1):: HPO=0 :: GOTO 1050
1160 HPO=HPO-1 :: AHP=AHP+10 :: IF AHP>AMHP THEN AHP=AMHP
1170 RETURN
1180 IF MPO<1 THEN CALL SOUND(30,440,1):: MPO=0 :: GOTO 1050
1190 MPO=MPO-1 :: AMP=AMP+10 :: IF AMP>AMMP THEN AMP=AMMP
1200 RETURN
1210 IF ELI<1 THEN CALL SOUND(30,440,1):: ELI=0 :: GOTO 1050
1220 ELI=ELI-1 :: AHP=AHP+5 :: IF AHP>AMHP THEN AHP=AMHP
1230 AMP=AMP+5 :: IF AMP>AMMP THEN AMP=AMMP
1240 RETURN
1250 REM ARMOR MENU
1260 GOSUB 1440 :: DISPLAY AT(1,12):"ARMOR";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB 1470
1270 GOSUB 1560
1280 IF K=13 THEN GOTO 710 ELSE 1270
1290 GOSUB 1440
1300 REM WEAPONS MENU
1310 GOSUB 1440 :: DISPLAY AT(1,11):"WEAPONS";:: DISPLAY AT(2,11):"^^^^^^^" :: GOSUB 1470
1320 GOSUB 1560
1330 IF K=13 THEN GOTO 710 ELSE 1320
1340 GOSUB 1440
1350 REM SPELLS MENU
1360 GOSUB 1440 :: DISPLAY AT(1,12):"SPELLS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB 1470
1370 GOSUB 1560
1380 IF K=13 THEN GOTO 710 ELSE 1370
1390 GOSUB 1440
1400 GOSUB 1440 :: DISPLAY AT(1,12):"STATUS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB 1470
1410 GOSUB 1560
1420 IF K=13 THEN GOTO 710 ELSE 1410
1430 CALL CLEAR :: GOTO 270
1440 REM     CLEAR MENU INFO
1450 DISPLAY AT(8,1):" ":" ":" ":" ":" ":" " :: DISPLAY AT(1,1):" ":" ":" " :: DISPLAY AT(22,1):" ":" "
1460 RETURN
1470 REM MENU RETURN GAME STRING
1480 DISPLAY AT(22,5):EX$;:: DISPLAY AT(23,5):EXU$;
1490 RETURN
1500 DISPLAY AT(1,9):"FORESTIA"
1510 DISPLAY AT(2,1):"BERYL":"HP:";BHP:"MP:";BMP :: DISPLAY AT(2,9):"^^^^^^^^";
1520 DISPLAY AT(2,18):"REPTOSLICER" :: DISPLAY AT(3,18):"HP:";RHP :: DISPLAY AT(4,18):"MP:";RMP
1530 DISPLAY AT(6,1):"SKYLAR":"HP:";SHP:"MP:";SMP
1540 DISPLAY AT(6,18):"MARKUS" :: DISPLAY AT(7,18):"HP:";MHP :: DISPLAY AT(8,18):"MP:";MMP
1550 RETURN
1560 CALL KEY(0,K,S):: IF S=0 THEN 1560
1570 RETURN
1580 REM       **SUB TO CALL THE ASSEMBLY ROUTINE TO LOAD MAP INTO MEMORY**
1590 SUB LDAT
1600 CALL INIT
1610 CALL LOAD("DSK1.NEWFORO")
1620 SUBEND
1630 REM       **SUB TO DRAW THE MAP ONSCREEN**
1640 SUB SETMAP(MX,MY)
1650 X=MX :: Y=MY
1660 IF ADR<>0 THEN 1690
1670 CALL PEEK(16382,P,Q)
1680 ADR=P*256+Q+2
1690 Y=Y-1 :: MAP=Y*2+X
1700 IF MAP<1 OR MAP>12 THEN SUBEXIT
1710 CALL LOAD(ADR,0,MAP)
1720 CALL LINK("DRAW")
1730 SUBEND

Updated TIdBiT source:

 

REM Beryl Reichardt TIdBiT transfer workstation:
REM 3/18/15
 
 
 
 
 
          // first  thing to do is call the link up to load the map data into memory
 
InitLoad-MapData: 
     CALL LDAT
 
 
PlayerStartup:
 
          // Give player a "place to start"
          // MX and MY are which map in the world are going to be drawn.  In this case, it's 1,1
          // PX&PY are the players' X location and Y location on the screen
          // SPX and SPY are the location of the SPRITE corresponding to the character position
 
     MX=1 :: MY=1
     PX=18 :: PY=8
     SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
 
 
          // These are party inventory... Starting with 100 gold, 4 health potions, 4 magic potions, 4 Elixirs, and zero scrolls
 
     GLD=100 :: HPO=4 :: MPO=4 :: ELI=4 :: SCR=0
 
 
          // These are repeated strings.  Currently there are only two, but there will be many more to come
 
     EX$="PRESS ENTER TO EXIT"
     BS$="BROADSWORD"
     EXU$="^^^^^^^^^^^^^^^^^^^"
 
 
 
 
          // These are Individual statistics for Beryl, Skylar, and Markus.  
          // MHP is max health power, HP is current health power
          // MMP is max magic power, MP is current magic power
          // DEF and ATK are the current stats for defense and attack
          // MDEF and MATK are max stats for defense and attack
 
     BMHP=20 :: BHP=15 :: BMMP=20 :: BMP=5 :: BDEF=10 :: BATK=10 :: BMDEF=7 :: BMATK=4
     RMHP=16 :: RHP=5 :: RMMP=40 :: RMP=20 :: RDEF=3 :: RATK=4 :: RMDEF=10 :: RMATK=12
     MMHP=25 :: MHP=18 :: MMMP=0 :: MMP=0 :: MDEF=15 :: MATK=15 :: MMDEF=5 :: MMATK=0
     SMHP=12 :: SHP=5 :: SMMP=20 :: SMP=12 :: SDEF=5 :: SATK=4 :: SMDEF=9 :: SMATK=8
 
          //These are the player "levels".  When the player level goes up, so will most of the maximum stats above.
 
     BLEV=1 :: RLEV=1 :: MLEV=1 :: SLEV=1
 
 
Setscreen:
 
          // set up screen and border for exploration routines
 
     CALL CLEAR
     CALL SCREEN(2) !black screen
 
     //Draw Exploration Screen//
 
DrawScreen:
 
     CALL HCHAR(9,1,101,32):: CALL HCHAR(24,1,101,32):: CALL VCHAR(9,1,97,16):: CALL VCHAR(9,32,97,16) !border around viewport
     CALL HCHAR(9,1,98):: CALL HCHAR(9,32,100):: CALL HCHAR(24,1,99):: CALL HCHAR(24,32,96) !corners
     CALL CHAR(42,"193DD9FFD91924C3"):: CALL COLOR(2,16,2) !CHAR(42) is the little character representation so far... may change soon
     GOSUB TopInfo
 
                //****BEGIN GAME LOOP****//
TopGameLoop:
 
          // This is the very top of the game loop.
 
     CALL SETMAP(MX,MY)
     CALL SPRITE(#1,42,16,SPX,SPY)
 
MidGameLoop:
 
          // midpoint for returns from bottom of loop
          // displays the character on screen based on player position
 
     SPX=(PX-1)*8+1 :: SPY=(PY-1)*8+17
     CALL LOCATE(#1,SPX,SPY)
 
 
 
MidgameLoop-Keyscan:
 
     GOSUB Keyscan
 
          //upon keypress, up down, left, right checking for tiles in the direction selected
          //must be a tile below (lower than)CHR$(104)  to allow motion
          //must add 2 to each column to compensate for the DISPLAY/GCHAR offset
 
     IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PX=PX-1 :: GOTO CheckBoundary
     IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PY=PY-1 :: GOTO CheckBoundary
     IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PY=PY+1 :: GOTO CheckBoundary
     IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: IF Q>104 THEN GOTO MidgameLoop-Keyscan ELSE PX=PX+1 :: GOTO CheckBoundary
 
          //If M is pressed, goto menu block, if space bar, goto examine block
 
     IF K=32 THEN GOSUB Examine
     IF K=77 THEN GOTO MainMenu
     GOTO MidgameLoop-Keyscan
 
 
CheckBoundary:
 
          // this determines the boundaries onscreen and sets the map to be drawn by assembly routine
          // PX, PY are the current player's position on the screen
          // MX, MY are the designations for which map will be drawn
 
 
     IF PX<11 THEN PX=22 :: MY=MY-1 :: GOTO CheckMap !if player walks off top of screen, place character on opposite side of screen
     IF PX>22 THEN PX=11 :: MY=MY+1 :: GOTO CheckMap !if player walks off bottom of screen, place character on opposite side of screen
     IF PY<1 THEN PY=28 :: MX=MX-1 :: GOTO CheckMap !if player walks off left of screen, place character on opposite side of screen
     IF PY>28 THEN PY=1 :: MX=MX+1 :: GOTO CheckMap !if player walks off right of screen, place character on opposite side of screen
     GOTO MidGameLoop
 
 
CheckMap:
 
     IF MX<1 THEN MX=1 ELSE IF MX>2 THEN MX=2
     IF MY<1 THEN MY=1 ELSE IF MY>6 THEN MY=6
     CALL DELSPRITE(#1)
     GOTO TopGameLoop
 
 
          //END GAME LOOP!!!!!!!!!!!!//
 
          //***SUBROUTINES BELOW***//
 
 
 
 
          //BEGIN EXAMINE LOOP//
Examine:
 
     DISPLAY AT(1,1):" ":" ":" ":" ":" ":" ":" ":" "
     DISPLAY AT(1,1):"WHICH DIRECTION?";
 
ExamineKeyscan:
 
     GOSUB Keyscan
     IF K=69 THEN CALL GCHAR(PX-1,PY+2,Q):: GOSUB ExamineCheck :: RETURN
     IF K=83 THEN CALL GCHAR(PX,PY+1,Q):: GOSUB ExamineCheck :: RETURN
     IF K=68 THEN CALL GCHAR(PX,PY+3,Q):: GOSUB ExamineCheck :: RETURN
     IF K=88 THEN CALL GCHAR(PX+1,PY+2,Q):: GOSUB ExamineCheck :: RETURN
     GOTO ExamineKeyscan
 
ExamineCheck:
          //This is the "YES" or "correct tile, IS an item" bit
     IF Q=115 THEN IT$=BS$ :: GOTO ItemYesFlag
 
          //This is the "NO" or "incorrect tile, is not an item" bit
     DISPLAY AT(1,1):" " :: GOSUB TopInfo :: RETURN
 
ItemYesFlag:
     DISPLAY AT(1,1):"YOU FOUND A ";IT$;:"ADD TO INVENTORY? (Y/N)";
 
 
MidExamineLoop-Keyscan:
     GOSUB Keyscan
     IF K=89 THEN DISPLAY AT(1,1):" ":" " :: GOSUB TopInfo :: RETURN
     IF K=78 THEN DISPLAY AT(1,1):" ":" " :: GOSUB TopInfo :: RETURN
     GOTO MidExamineLoop-Keyscan
 
 
     //END EXAMINE LOOP//
 
 
 
 
 
          //BEGIN MENU LOOP//
MainMenu:          
REM  MENU
     CALL CLEAR :: CALL SCREEN(2):: CALL DELSPRITE(#1)
     CALL HCHAR(5,1,101,32):: CALL HCHAR(20,1,101,32):: CALL VCHAR(5,1,97,15):: CALL VCHAR(5,32,97,15)
     CALL HCHAR(5,1,98):: CALL HCHAR(5,32,100):: CALL HCHAR(20,1,99):: CALL HCHAR(20,32,96)
 
MainMenu-MiddleReturn:
 
     GOSUB ClearMenu :: GOSUB ReturnString
     DISPLAY AT(8,1):"1) ITEMS":"2) ARMOR":"3) WEAPONS":"4) SPELLS":"5) STATUS";
 
 
MidMenu-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN CALL CLEAR :: GOTO DrawScreen !**BUG FIXED HERE** Case-sensitive labels
     IF K>54 THEN GOTO MidMenu-Keyscan ELSE IF K<49 THEN GOTO MidMenu-Keyscan
     ON K-48 GOTO ItemMenu,ArmorMenu,WeaponsMenu,SpellsMenu,StatusMenu
 
 
          //Item Menu Block//
 
ItemMenu:
 
     REM ITEM MENU
     GOSUB ClearMenu
     DISPLAY AT(1,12):"ITEMS";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB ReturnString
     DISPLAY AT(8,1):"USE ON WHICH CHARACTER?";:"1) BERYL";:"2) REPTOSLICER";:"3) MARKUS";:"4) SKYLAR";
 
MidItem-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn !**BUG FIXED---incorrect label here, did not allow return to Main Menu
     IF K>52 THEN GOTO MidItem-Keyscan ELSE IF K<49 THEN GOTO MidItem-Keyscan
     ON K-48 GOSUB ItemBeryl,ItemRepto,ItemMarkus,ItemSkylar
     GOTO ItemMenu
 
 
 
          //ACN=name, ANSP=name starting point, ANL=name length//
 
ItemBeryl:
     REM BERYL
     AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ACN$="BERYL" :: ANSP=12 :: ANL=5
     GOSUB ItemMenu2
     BHP=AHP :: BMP=AMP :: RETURN
 
ItemRepto:
     REM REPTO 
     AMHP=RMHP :: AHP=RHP :: AMMP=RMMP :: AMP=RMP :: ACN$="REPTOSLICER" :: ANSP=9 :: ANL=11
     GOSUB ItemMenu2
     RHP=AHP :: RMP=AMP :: RETURN
 
ItemMarkus:
     REM MARKUS
     AMHP=MMHP :: AHP=MHP :: AMMP=MMMP :: AMP=MMP :: ACN$="MARKUS" :: ANSP=12 :: ANL=6
     GOSUB ItemMenu2
     MHP=AHP :: MMP=AMP :: RETURN
 
ItemSkylar:
     REM SKYLAR
     AMHP=SMHP :: AHP=SHP :: AMMP=SMMP :: AMP=SMP :: ACN$="SKYLAR" :: ANSP=12 :: ANL=6
     GOSUB ItemMenu2
     SHP=AHP:: SMP=AMP :: RETURN
 
 
     REM **THIS IS THE MEAT OF THE ITEM MENU CODE**
 
ItemMenu2:
 
 
     GOSUB ClearMenu :: DISPLAY AT(1,ANSP):ACN$;:: CALL HCHAR(2,ANSP+2,94,ANL)
     GOSUB ReturnString
 
ItemDisplay:
 
     DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;
     DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
 
MidItem2-Keyscan:
     GOSUB Keyscan !***BUG FIXED HERE*** Spelled, "Keyscancan"
     IF K=13 THEN GOTO ItemMenu
     IF K>51 THEN GOTO MidItem2-Keyscan ELSE IF K<49 THEN GOTO MidItem2-Keyscan
     ON K-48 GOSUB HealthPotion,MagicPotion,Elixir
     CALL SCREEN(16):: FOR I=1 TO 20 :: NEXT I :: CALL SCREEN(2)
     DISPLAY AT(3,1):"HP:";AHP;"/";AMHP;:: DISPLAY AT(3,16):"MP:";AMP;"/";AMMP;
     DISPLAY AT(8,1):"1) POTION";HPO;:"2) ETHER";MPO;:"3) ELIXIR";ELI;:: FOR I=1 TO 400 :: NEXT I
     RETURN
 
 
          //Use HealthPotion//
 
HealthPotion:
 
     IF HPO<1 THEN CALL SOUND(30,440,1):: HPO=0 :: GOTO ItemDisplay
     HPO=HPO-1 :: AHP=AHP+10 :: IF AHP>AMHP THEN AHP=AMHP
     RETURN
 
          //Use MagicPotion//
 
MagicPotion:
 
     IF MPO<1 THEN CALL SOUND(30,440,1):: MPO=0 :: GOTO ItemDisplay
     MPO=MPO-1 :: AMP=AMP+10 :: IF AMP>AMMP THEN AMP=AMMP
     RETURN
 
          //Use Elixir//
 
Elixir:
 
     IF ELI<1 THEN CALL SOUND(30,440,1):: ELI=0 :: GOTO ItemDisplay
     ELI=ELI-1 :: AHP=AHP+5 :: IF AHP>AMHP THEN AHP=AMHP
     AMP=AMP+5 :: IF AMP>AMMP THEN AMP=AMMP
     RETURN
 
 
 
 
 
          //Armor Menu//
 
ArmorMenu:
     
     REM ARMOR MENU
     GOSUB ClearMenu :: DISPLAY AT(1,12):"ARMOR";:: DISPLAY AT(2,12):"^^^^^" :: GOSUB ReturnString
 
MidArmor-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidArmor-Keyscan
     GOSUB ClearMenu
 
WeaponsMenu: 
 
     REM WEAPONS MENU
     GOSUB ClearMenu :: DISPLAY AT(1,11):"WEAPONS";:: DISPLAY AT(2,11):"^^^^^^^" :: GOSUB ReturnString
 
MidWeapons-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidWeapons-Keyscan
     GOSUB ClearMenu
 
SpellsMenu:
 
     REM SPELLS MENU
     GOSUB ClearMenu :: DISPLAY AT(1,12):"SPELLS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB ReturnString
 
MidSpells-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidSpells-Keyscan
     GOSUB ClearMenu
 
//**************************//
//**** NEXT AREA OF WORK****//
//**************************//
 
     //REM STATUS MENU//
     //REM THIS IS THE NEXT AREA OF FOCUS... GET WORKING STATUS MENU GOING BY LOADING THE "A" SET WITH CHAR'S INFO//
     //REM **USE THESE: ALEV=BLEV :: AMHP=BMHP :: AHP=BHP :: AMMP=BMMP :: AMP=BMP :: ADEF=BDEF :: AATK=BATK :: AMDEF=BMDEF//
     //REM **AMATK=BMATK :: ACN$="BERYL" :: ANSP=14 :: ANL=5//
 
StatusMenu:
 
     GOSUB ClearMenu :: DISPLAY AT(1,12):"STATUS";:: DISPLAY AT(2,12):"^^^^^^" :: GOSUB ReturnString
 
MidStatus-Keyscan:
 
     GOSUB Keyscan
     IF K=13 THEN GOTO MainMenu-MiddleReturn ELSE MidStatus-Keyscan
     CALL CLEAR :: GOTO DrawScreen
 
          //ClearMenu//
ClearMenu:
 
     REM     CLEAR MENU INFO
     DISPLAY AT(8,1):" ":" ":" ":" ":" ":" " :: DISPLAY AT(1,1):" ":" ":" " :: DISPLAY AT(22,1):" ":" "
     RETURN
 
 
          //ReturnString//
 
ReturnString:
 
     REM MENU RETURN GAME STRING
     DISPLAY AT(22,5):EX$;:: DISPLAY AT(23,5):EXU$;
     RETURN
 
 
 
TopInfo: 
 
          //this displays all necessary information at the top of the screen during gameplay
 
 
     DISPLAY AT(1,9):"FORESTIA"
     DISPLAY AT(2,1):"BERYL":"HP:";BHP:"MP:";BMP :: DISPLAY AT(2,9):"^^^^^^^^";
     DISPLAY AT(2,18):"REPTOSLICER" :: DISPLAY AT(3,18):"HP:";RHP :: DISPLAY AT(4,18):"MP:";RMP
     DISPLAY AT(6,1):"SKYLAR":"HP:";SHP:"MP:";SMP
     DISPLAY AT(6,18):"MARKUS" :: DISPLAY AT(7,18):"HP:";MHP :: DISPLAY AT(8,18):"MP:";MMP
     RETURN
 
 
 
Keyscan:
 
     CALL KEY(0,K,S):: IF S=0 THEN Keyscan
     RETURN
 
 
          //SUB LDAT//
     REM       **SUB TO CALL THE ASSEMBLY ROUTINE TO LOAD MAP INTO MEMORY**
     SUB LDAT
     CALL INIT
     CALL LOAD("DSK1.NEWFORO")
     SUBEND
 
          //SUB SETMAP//
     REM       **SUB TO DRAW THE MAP ONSCREEN**
     SUB SETMAP(MX,MY)
     X=MX :: Y=MY
     IF ADR<>0 THEN MidSetmap-Check
     CALL PEEK(16382,P,Q)
     ADR=P*256+Q+2
 
MidSetmap-Check:
 
     Y=Y-1 :: MAP=Y*2+X
     IF MAP<1 OR MAP>12 THEN SUBEXIT
     CALL LOAD(ADR,0,MAP)
     CALL LINK("DRAW")
     SUBEND
 

Link to comment
Share on other sites

 

What is Python based? TidBit is written in PHP and the parser strips all leading and trailing white-space and does not pay attention to any indentation. I also provide the converter on my website so you can try it now without having to set anything up.

Thanks Matthew ..... sorry. it looked slightly python-esque. I'll give it a try

Link to comment
Share on other sites

  • 1 year later...

I have added a new feature to TidBit that has to do with TidBit's continuation .. operator. Where possible I made it so you can leave it out and still get the lines joined. You can leave out the .. in the following instances:

* Following an XB multi-line :: operator
* Following a THEN or ELSE keyword
* If the next line is the ELSE keyword

For example:

// Old way
A=1 :: ..
B=2

IF A=1 THEN ..
  A=2 :: ..
  B=3 ..
ELSE ..
  A=3 :: ..
  B=4
ENDIF


// New way
A=1 ::
B=2

IF A=1 THEN
  A=2 ::
  B=3
ELSE
  A=3 ::
  B=4
ENDIF


// You can even have comments and blank lines before the ELSE:
IF A=1 THEN
  B=2

// The blank line and this comment will not interfere with the continuation.
ELSE
  B=A*2
ENDIF

The output for all the above code is:

100 A=1 :: B=2
110 IF A=1 THEN A=2 :: B=3 ELSE A=3 :: B=4
120 A=1 :: B=2
130 IF A=1 THEN A=2 :: B=3 ELSE A=3 :: B=4
140 IF A=1 THEN B=2 ELSE B=A*2

I also added a check where you cannot use the word "PRINT" (case is irrelevant) as a label. This was to prevent a possible bug due to the use of one or more colons in a normal PRINT statement, i.e.:

PRINT: : :

That is a valid XB statement and would have been interpreted by TidBit as a label. Not any more. :-)

tidbit_v2.1.zip

  • Like 5
Link to comment
Share on other sites

  • 2 weeks later...

Just wanted to say I did a mega conversion of a BASIC project over to the TIdBiT format and it is now like cutting butter with a hot knife. :)

 

The original game concept and coding was done just as a proof of concept in BASIC. I let it go and go and go until I didn't understand what was going on anymore. Taking a couple months away didn't help, either. :)

 

 

Anyway, now that it is converted, my life is much more pleasant.

 

 

I know I have said it before, but THANK YOU FOR TIDBIT!!!

  • Like 2
Link to comment
Share on other sites

No, that one is comfortably in TIdBiT already. I am having other issues with that game. Got hung on an assembly linkup problem and haven't got back to it.

 

The game I have been converting is the Jedi Gauntlet game. It is now legible, clean, and streamlined.

 

Need to spend some time with Magellan now so I can manipulate some tiles for level-specific game-states.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Some odd behavior noted using TidBit:

In this first screen shot I show the TidBit screen and behind it is Notepad++ (simpy for the built in line numbers)

To the point:

TidBit translates this incorrectly:

IF C=0 THEN RETURN ELSE _FALL

TidBit's Translation: 920 IF C=0 THEN RETURN ELSE _FALL

 

post-47352-0-32988000-1473621789_thumb.png

 

TidBit translates this correctly:

IF C<>0 THEN _FALL ELSE RETURN

TidBit's Translation: 920 IF C<>0 THEN 2020 ELSE RETURN

 

post-47352-0-12184200-1473621807_thumb.png

 

Here's the source code for the above examples:

ZOMBtiV034_source.txt

 

Doing it here as well.

post-47352-0-32016000-1473637585_thumb.png

 

And again, this fixed it

 

post-47352-0-38658000-1473638147_thumb.png

 

EDIT: I can't seem to get TidBit working locally so I'm using TidBit on the net from here: >>TidBit<<

Edited by Sinphaltimus
Link to comment
Share on other sites

Thanks for the feedback, I have found the bug and I'm working on a fix. I have also found a few potential bugs and I'm working on fixing those too before they cause any problems.

I can't seem to get TidBit working locally


Can you give more detail? Exactly what is not working? Do you have PHP installed and can your run it (i.e.: php -v) from the command line? Are you trying to run from the command line or as a local web page?

  • Like 1
Link to comment
Share on other sites

Can you give more detail? Exactly what is not working? Do you have PHP installed and can your run it (i.e.: php -v) from the command line? Are you trying to run from the command line or as a local web page?

I know nothing of PHP. I downloaded php for windows but it did not have an installer. I saw notes on the tidbit page about adding paths so instead of doing that, I just decompressed to my tidbit folder. I run php, it opens a prompt, I run all 3 of the tidbit php files and nothing. Just kinda sits there.

 

I think the problem is in front of the keyboard which is why I just went to the web for now.

 

Do I need to install PHP from a different source? Yes I can add paths to windows no problem. I think this is the latest version of php, not sure. First time ever doing anything with it. It came in a zip file : php-7.0.10-nts-Win32-VC14-x86.zip source: http://windows.php.net/download/

 

post-47352-0-01159400-1473761932_thumb.png

Edited by Sinphaltimus
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...