Major issues for M100 Basic to NEC PC-8201 Basic Conversion 1. Convert all 'PRINT @nn,' statements to 'LOCATE X,Y : PRINT' statements.X is equivalent to (nn MOD 40) Y is equivalent to (nn \ 40) 2. LINE(X,Y)-(X1,Y1) statements require that LINE.CO is installed. 3. Any use of CHR$(131)-CHR$(255) requires CHR100.CO or LAPTOP.CO. 4. ON KEY GOSUB, and the counterparts KEYON and KEYOFF, are not supported N82 Basic features. There isn't a way to automatically interrupt & call a subroutine based on a keystroke. What you have to do instead is poll the keyboard using INKEY$ and check for the key value, and branch manually to the subroutines desired. You could make a subroutine that does this that you simply call at various places in the main program loop. 5. VARPTR isn't a supported N82 Basic statement, but can be implemented through a routine like this: 40000 H=0:L=0:TY=0 40010 POKE64448,205:POKE64449,175:POKE64450,73:POKE64451,235 40020 POKE64452,58:POKE64453,139:POKE64454,250:POKE64456,201 40030 IFVY$=""THENPRINT"VY$ not defined!":STOP 40040 FORH=64457TO64463:POKEH,ASC(MID$(VY$,H,1)+CHR$(0)):NEXT:POKE64464,0 40050 POKE63912,201:POKE63913,251:EXEC64448 40060 L=PEEK(63912!):H=PEEK(63913!):TY=PEEK(63911!) 40070 RETURN 40080 ' VARPTR by Gary Weber 40090 ' Entry: VY$ must contain the name of variable of interest 40100 ' Exit: H & L contain variable's address, TY contains type 40110 ' Example: 40120 ' 100 A$="This is a sample string." 40130 ' 110 VY$="A$":GOSUB 40000 40140 ' 120 PRINT "VARPTR of ";VY$;" is ";L+(H*256)6. CALL statements require special conversion to EXEC with appropriately converted ROM address (using memory maps). Also, the M100's CALL syntax allows passing of values to place in the HL and A registers. The NEC's EXEC statement only takes one parameter, which is the entry address. However, there are special locations in the upper memory "bookkeeping" area which are used to pass HL and A register values to EXEC, and you simply POKE the values to those locations. More info can be found on this in the NEC PC-8201/8300 Memory Map. 7. Any embedded machine language would need to be disassembled, have the ROM & bookkeeping RAM address converted, and recompiled/embedded into the program. 8. POKE & PEEK addresses require special conversion (using memory maps). 9. MID$ as an assignment is not supported in N82 basic. You can only use the MID$ statement to extract characters from a string. However, you can simulate the function of a MID$ assignment with a routine like this: 30000 ZO=LEN(OX$):TX$=OX$:OX$=LEFT$(TX$,NX-1)+NX$ 30010 IFZO-LEN(OX$)>0THENOX$=OX$+RIGHT$(TX$,ZO-LEN(OX$)) 30020 OX$=LEFT$(OX$,ZO):RETURN 30030 ' MID$ by Gary Weber 30040 ' Entry: OX$=String to modify, NX=Target position, NX$=Target text 30050 ' Exit: OX$ contains modified string |