CPC Basic

Would you like to react to this message? Create an account in a few clicks or log in to continue.
CPC Basic

Basic cross-compiler for Amstad CPC


2 posters

    custom RSX commands

    avatar
    poppichicken


    Posts : 16
    Join date : 2012-03-16

    custom RSX commands Empty custom RSX commands

    Post  poppichicken Tue Mar 27, 2012 10:38 am

    Hi there.

    I have a little question for you, if I may.
    Cool

    In CPC BASIC, there is the facility to use your own custom RSX commands.
    Is this possible using CPC BASIC 3?

    For example, in the code below, it looks like 3 RSX commands are defined from lines 250 to 650.
    |ON, |OFF and |PUTSPRITE.

    Is it possible to do something like this?
    There would need to be some way to make the compiler understand what these mean, but I can't imagine that it's possible.

    Code:
    10 '********************
    20 '*      MONGUI      *
    30 '*      por        *
    40 '*      OSCAR      *
    50 '*    VALLADARES    *
    60 '*        &        *
    70 '*  AMSTRAD USER  *
    80 '*      -1989-      *
    90 '********************
    100 CALL &BC02
    110 '***************
    120 '*  LECTORES  *
    130 '***************
    140 MODE 0:INK 0,0:INK 1,10:INK 2,26:INK 3,6:INK 4,11:INK 5,24:INK 6,1:INK 7,15:INK 8,2:INK 9,3:INK 10,9:INK 11,3:INK 13,11:INK 14,1
    9:PEN 12:BORDER 3:PAPER 11
    150 LOCATE 1,25:PEN 13:PRINT"ESPERE UN MOMENTO";
    160 A=1:dir=1:RESTORE 250:FOR x=&8000 TO &813B
    170 READ a$:a=VAL("&"+a$):POKE x,a:NEXT:CALL &8000
    180 RESTORE 290:FOR x=&8150 TO &8AA0+220
    190 READ a$:a=VAL("&"+a$)
    200 POKE x,a
    210 NEXT
    220 '**************
    230 '*  GRAFICOS  *
    240 '**************
    250 DATA 01,0A,80,21,15,80,CD,D1,BC,C9,19,80,C3,56,80,C3,28,80,C3,E0,80,F8,A6,0A,80,4F,CE,50,55,54,53,50,52,49,54,C5,4F,46,C6,00,DD,
    6E,00,DD,66,01,DD,5E,02,DD,56,03,CD,1D,BC,22,07,81,22,0D,81,2A,0B,81,22,13,81,22,11,81,2A,05,81,CD,19,BD,CD,8C,80,2A
    260 DATA 07,81,22,0F,81,C9,DD,6E,04,DD,66,05,7E,32,05,81,23,7E,32,06,81,23,22,0B,81,DD,6E,00,DD,66,01,DD,5E,02,DD,56,03,CD,1D,BC,E5,
    22,0F,81,22,0D,81,2A,0B,81,22,13,81,CD,B1,80,E1,C3,37,80,22,05,81,45,2A,0F,81,11,00,90,F3,C5,3A,06,81,47,E5,1A,77,23
    270 DATA 13,10,FA,E1,7C,C6,08,67,30,04,01,50,C0,09,C1,10,E6,CD,15,81,2A,0D,81,ED,5B,13,81,3A,05,81,47,C5,3A,06,81,47,E5,1A,FE,00,28,
    02,1A,77,23,13,10,F5,E1,7C,C6,08,67,30,04,01,50,C0,09,C1,10,E1,FB,C9,2A,07,81,11,00,90,3A,05,81,47,C5,E5,3A,06,81,47
    280 DATA 1A,77,23,13,10,FA,E1,7C,C6,08,67,30,04,01,50,C0,09,C1,10,E6,C9,1E,08,F2,DB,00,00,02,60,F2,DB,F2,DB,02,60,02,60,E5,2A,0D,81,
    11,00,90,3A,05,81,47,C5,E5,3A,06,81,47,7E,12,23,13,10,FA,E1,7C,C6,08,67,30,04,01,50,C0,09,C1,10,E6,E1,C9
    290 DATA 21,08,00,44,82,00,00,00,00,00,00,44,82,00,00,00,00,00,00,CC,C9,00,00,00,00,00,00,CC,C9,00,00,00,00,00,44,CC,CC,82,00,00,00,
    00,44,CC,44,82,00,00,00,00,44,CC,CC,82,00,44,82,00,44,CC,CC,82,00,44,82,00,44,88,CC,82,00,CC,C9,00,44,88,CC,82,00,88,C9
    300 DATA 00,44,88,CC,82,44,CC,CC,82,44,CC,CC,82,44,88,CC,82,44,CC,CC,C6,44,CC,CC,C6,44,EC,EC,C6,44,EC,A8,C6,44,CC,CC,C6,44,CC,88,C6,
    44,CC,CC,C6,44,CC,CC,C6,44,CC,44,C6,44,CC,CC,C6,44,88,CC,82,44,CC,CC,82,44,88,CC,82,44,CC,CC,82,00,CC,CC,82,44,CC,CC
    310 DATA 82,44,CC,CC,82,44,CC,CC,82,00,CC,CC,82,44,CC,CC,82,44,CC,CC,82,44,CC,CC,82,44,CC,CC,82,44,88,CC,82,44,88,CC,82,44,CC,CC,82,
    44,88,CC,82,44,CC,CC,82,44,CC,CC,C6,44,88,CC,C6,44,CC,CC,C6,44,CC,CC,C6,44,EC,CC,CC,44,A8,EC,C6,44,CC,CC,C6,44,CC,CC,C6
    320 DATA 44,CC,CC,82,44,CC,44,82,44,CC,CC,82,44,CC,44,82,44,CC,CC,82,44,CC,44,82,0F,08,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,
    E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,E4,F0,F0,F0,F0,F0,F0,F0,F0,CC,D8,CC,CC,CC,D8,CC,CC,CC,D8,CC,CC,CC
    330 DATA D8,CC,CC,CC,D8,CC,CC,CC,D8,CC,CC,CC,D8,CC,CC,CC,D8,CC,CC,F0,F0,F0,F0,F0,F0,F0,F0,E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,
    CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,E4,CC,CC,CC,F0,F0,F0,F0,F0,F0,F0,F0,12
    340 DATA 08,C0,84,C2,C0,C0,49,C0,C0,C0,84,C2,C0,C0,49,C0,C0,C0,84,C2,C0,C0,49,C0,C0,C0,84,C2,C0,C0,49,C0,C0,0C,0C,86,0C,0C,49,0C,0C,
    C3,C3,82,C3,C3,C3,C3,C3,C2,C0,C0,49,C0,C0,C0,84,C2,C0,C0,49,C0,C0,C0,84,C2,C0,C0,49,C0,C0,C0,84,C2,C0,C0,49,C0,C0,C0,84
    350 DATA 86,0C,0C,49,0C,0C,0C,0C,C3,C3,C3,C3,C3,C3,C3,C3,C0,C0,49,C0,C0,C0,49,C0,C0,C0,49,C0,C0,C0,49,C0,C0,C0,49,C0,C0,C0,49,C0,C0,
    C0,49,C0,C0,C0,49,C0,0C,0C,49,0C,0C,0C,49,0C,C3,41,C3,C3,C3,C3,C3,C3,1F,07,00,A0,00,00,A0,00,00,00,8C,00,00,88,00,00
    360 DATA 00,A0,08,04,88,00,00,00,00,08,08,A0,00,00,00,00,5C,08,00,00,00,00,00,5C,A8,00,00,00,00,00,5C,FC,00,00,00,00,00,FC,54,A8,00,
    00,A8,00,FC,54,FC,00,00,A8,00, FC,FC,FC,A8,00,A8,00,FC,FC,54,A8,00,FC,00,A8,FC,00,00,00,FC,00,FC,00,00,00,00,30,00,FC
    370 DATA FC,00,00,00,30,20,54,FC,00,00,00,10,30,54,EC,20,00,00,00,30,64,CC,30,00,00,00,10,64,CC,30,A8,00,00,00,64,CC,10,FC,00,00,00,
    CC,4C,00,FC,A8,00,00,0C,04,00,00,00,00,00,80,40,00,00,00,00,00,08,04,00,00,00,00,00,80,40,00,00,00,00,00,08,04,00,00
    380 DATA 00,00,00,20,10,00,00,00,A8,00,30,10,20,00,00,54,FC,FC,FC,FC,FC,00,00,50,00,00,50,00,00,00,B0,A0,00,B0,A0,00,00,50,00,00,50,
    00,00,1F
    390 DATA 06,00,00,00,00,50,00,00,50,00,00,04,00,00,04,00,00,58,00,00,50,5C,AC,00,00,00,00,FC,AC,00,00,00,00,A8,FC,00,00,00,00,A8,FC,
    00,00,00,54,FC,FC,00,00,00,FC,FC,FC,00,54,54,FC,FC,54,00,54,54,A8,00,FC,00,54,00,00,FC,FC,00,FC,00,00,44,EC,20,30,00,00
    400 DATA 44,CC,30,30,00,00,64,CC,30,30,00,10,64,CC,30,20,00,30,64,CC,98,00,54,30,44,CC,88,00,54,30,CC,CC,00,00,FC,20,CC,C0,00,00,00,
    00,40,40,00,00,00,00,04,04,00,00,00,00,40,40,00,00,00,00,04,04,00,00,00,00,40,40,00,00,00,00,44,44,00,00,00,00,88,CC
    410 DATA 00,54,FC,FC,FC,FC,FC,A8,00,A0,00,00,A0,00,50,52,00,50,52,00,00,A0,00,00,A0,00,24
    420 DATA 08,C3,C3,C3,C3,C3,C3,C3,C3,C9,C3,C3,C3,C3,C3,C3,C6,CC,C3,C3,C3,C3,C3,C3,CC,CC,FC,FC,FC,FC,FC,FC,CC,CC,FC,FC,FC,FC,FC,FC,CC,
    CC,FC,FC,FC,FC,FC,FC,CC,CC,A8,00,54,A8,00,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC
    430 DATA CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,
    F8,FC,54,F8,FC,54,CC,CC,F8,F0,F4,F8,F0,F4,CC,CC,FC,FC,FC,FC,FC,FC,CC,CC,0C,FC,FC,FC,FC,FC,CC,CC,0C,03,FC,FC,FC,FC,CC
    440 DATA CC,FC,FC,FC,FC,FC,FC,CC,CC,A8,00,54,A8,00,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,
    F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC
    450 DATA F8,FC,54,F8,FC,54,CC,CC,F8,FC,54,F8,FC,54,CC,CC,F8,F0,F4,F8,F0,F4,CC,CC,FC,FC,FC,FC,FC,FC,CC,CC,FC,FC,FC,FC,FC,FC,CC,CC,FC,
    FC,FC,FC,FC,FC,CC,08,08,00,00,00,44,CC,CC,CC,CC,00,00,00,C9,C9,C9,C9,CC,00,00,44,C6,C3,C9,C9,CC,00,00,CC,C6,C6,C6,C6
    460 DATA C6,00,44,C9,C6,CC,C6,C6,C6,00,C9,C9,C9,C9,C6,C6,C6,44,C6,C6,C3,C9,C9,C6,C6,CC,CC,CC,CC,CC,CC,CC,CC,08,08,CC,CC,CC,CC,88,00,
    00,00,CC,C6,C6,C6,C6,00,00,00,CC,C6,C6,C3,C9,88,00,00,C9,C9,C9,C9,C9,CC,00,00,C9,C9,C9,CC,C9,C6,88,00,C9,C9,C9,C6,C6
    470 DATA C6,C6,00,C9,C9,C6,C6,C3,C9,C9,88,CC,CC,CC,CC,CC,CC,CC,CC,08
    480 DATA 08,CC,CC,CC,CC,CC,CC,CC,CC,C6,C6,C6,C6,C6,C9,CC,C3,C6,C6,C6,C3,C9,C9,CC,C6,C9,C9,C9,C9,C9,C9,C6,C6,C9,C9,C9,CC,C9,C6,C9,C9,
    C9,C9,C9,C6,C6,C6,C6,C9,C9,C9,C6,C6,C3,C9,C9,C9,CC,CC,CC,CC,CC,CC,CC,CC,19,08,CC,CC,CC,CC,CC,CC,CC,88,CC,CC,CC,CC,CC,CC
    490 DATA CC,88,DC,FC,FC,FC,FC,FC,FC,88,DC,00,00,54,00,00,54,88,DC,00,20,54,00,00,54,88,DC,00,10,54,10,00,54,88,DC,00,00,74,00,20,54,
    88,DC,00,00,54,00,10,54,88,DC,10,00,54,00,00,54,88,DC,00,20,54,20,00,54,88,DC,00,00,54,10,00,54,88,DC,00,00,54,00,00,54
    500 DATA 88,DC,FC,FC,FC,FC,FC,FC,88,DC,00,00,54,00,00,54,88,DC,00,00,54,20,00,54,88,DC,00,00,54,10,00,54,88,DC,00,20,54,00,20,54,88,
    DC,00,10,54,00,10,54,88,DC,00,00,54,00,00,54,88,DC,00,00,54,00,00,54,88,DC,00,00,54,20,00,54,88,DC,00,00,54,10,00,54,88
    510 DATA DC,FC,FC,FC,FC,FC,FC,88,CC,CC,CC,CC,CC,CC,CC,88,CC,CC,CC,CC,CC,CC,CC,88,0A
    520 DATA 08,00,00,04,48,08,00,00,00,04,48,0C,C0,00,08,00,00,48,C0,48,C0,C0,84,00,00,40,0C,48,C0,84,C0,08,00,40,C0,84,48,84,48,84,08,
    48,C0,C0,C0,C0,C0,C0,08,48,C0,48,84,C0,84,48,00,C0,0C,C0,48,48,C0,C0,08,84,48,80,C0,0C,C0,C0,00,40,80,00,00,C0,84,08,00
    530 DATA 1F,08,FC,FC,FC,FC,FC,FC,FC,FC,DC,FC,FC,FC,FC,FC,FC,EC,CC,FC,FC,FC,FC,FC,FC,CC,CC,00,00,00,00,00,00,CC,CC,30,30,30,30,30,30,
    CC,CC,30,30,30,30,0C,30,CC,CC,30,18,30,B0,24,18,CC,CC,24,18,70,F0,30,30,CC,CC,30,24,70,F0,30,30,CC,CC,30,30,F0,F0,B0
    540 DATA 30,CC,CC,30,30,F0,F0,B0,30,CC,CC,3C,3C,3C,3C,3C,3C,CC,CC,3C,3C,2D,3C,3C,3C,CC,CC,3C,3C,2D,1E,3C,3C,CC,CC,3C,3C,0F,3C,3C,3C,
    CC,CC,3C,3C,2D,3C,3C,3C,CC,CC,3C,3C,2D,3C,3C,3C,CC,CC,2D,1E,2D,3C,0F,3C,CC,CC,3C,0F,0A,0F,1E,3C,CC,CC,3C,2D,0F,0F
    550 DATA 1E,3C,CC,CC,3C,3C,3C,3C,3C,3C,CC,CC,3C,3C,3C,3C,3C,3C,CC,CC,3C,3C,3C,3C,3C,3C,CC,CC,3C,3C,3C,3C,3C,3C,CC,CC,3C,3C,3C,3C,3C,
    3C,CC,CC,3C,F0,F0,F0,F0,3C,CC,CC,3C,A0,00,00,50,3C,CC,CC,3C,F0,F0,F0,F0,3C,CC,CC,FC,FC,FC,FC,FC,FC,CC,DC,FC,FC,FC,FC
    560 DATA FC,FC,EC,FC,FC,FC,FC,FC,FC,FC,FC,0D
    570 DATA 05,F0,F0,F0,F0,A0,A0,A0,A0,A0,A8,F0,50,50,54,A8,F0,A0,A0,FC,A8,F0,F0,54,FC,A8,F0,F0,F4,FC,A8,F0,F0,F4,FC,A8,F0,F0,F4,FC,A8,
    F0,F0,F4,FC,A8,50,F0,F4,FC,00,00,F0,F4,A8,00,00,50,F4,00,00,00,00,A0,00,00,0A,08,0A,F0,0A,A0,A5,00,5A,0F,A0,F0,05,0A,A5
    580 DATA A5,5A,00,A5,05,A0,A0,0A,A0,F0,50,0A,05,0F,0A,0A,0F,05,05,A5,0A,F0,A0,50,F0,50,F0,05,50,A5,5A,0A,0A,05,A0,0A,0F,5A,00,00,5A,
    5A,A5,50,A5,50,50,F0,50,0A,05,00,0F,05,05,5A,50,00,5A,5A,A5,5A,50,05,0F,05,05,16,06,00,00,00,08,00,00,00,00,00,08,00
    590 DATA 00,00,00,04,8C,00,00,00,88,04,8C,00,00,44,E4,00,08,00,00,00,8D,00,08,00,00,00,00,0F,0A,00,00,00,05,05,0F,0A,00,00,05,00,0F,
    00,00,00,05,00,0A,00,00,00,05,0A,0A,00,00,00,CC,CC,CC,EC,82,00,CC,CC,CC,EC,82,00,CC,CC,CC,EC,82,00,00,00,00,00,00,00
    600 DATA 44,CC,DC,C9,00,00,44,CC,DC,C9,00,00,44,CC,DC,C9,00,00,00,CC,EC,82,00,00,00,CC,EC,82,00,00,00,CC,EC,82,00,00,00,CC,EC,82,00,
    04
    610 DATA 07,44,C3,CC,C9,CC,CC,00,CC,C9,CC,C9,C6,C9,88,CC,CC,C6,CC,C6,C6,88,44,CC,CC,CC,CC,CC,00,0E,04,00,04,80,00,00,0C,48,00,00,0C,
    84,00,00,0C,84,00,04,84,48,08,04,48,48,80,04,0C,84,80,04,0C,0C,08,04,48,C0,08,04,48,48,08,04,C0,48,08,04,0C,48,80,00,0C
    620 DATA 0C,00,00,04,08,00,06,08,00,00,00,00,00,30,30,20,00,00,00,00,00,20,00,00,30,30,30,30,30,30,30,20,30,30,21,03,03,20,00,00,03,
    03,02,00,00,30,30,20,00,00,00,00,00,03,03,02,1B
    630 DATA 08,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,CC,C3,C3,C3,C3,C3,C3,C3,C3,
    00,00,00,CC,CC,00,00,00,00,00,00,CC,CC,00,00,00,00,00,00,C6,C9,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00
    640 DATA 00,00,00,CC,CC,00,00,00,00,00,00,C6,C9,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,
    00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00
    650 DATA 00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,
    00,00,44,88,00,00,00,00,00,00,44,88,00,00,00,00,00,00
    660 MODE 0:WINDOW #2,20,1,1,8:PAPER #2,11:CLS #2:HS=0
    670 WINDOW #3,20,1,9,25:PAPER #3,0
    680 WINDOW #4,20,1,4,7:PAPER #4,11
    690 LOCATE 1,1:PEN 12:PAPER 11:PRINT"SCORE":LOCATE 13,1:PRINT"HI-SCORE":LOCATE 7,1:PRINT"LIVES"
    700 pu=1:y=43:dir=0:x=8:t=1:ALT=44:TU=0:y=51:ALT=52:SU=0:HABIT=1:XA=100:YA=52:SC=0:LI=3:DY=0:SU=20:PASA=0:FF=0:ob=0:obb=0
    710 LOCATE 2,3:PEN 13:PRINT SC:LOCATE 8,3:PRINT LI:LOCATE 16,3:PRINT HS
    720 '****************
    730 '*  PANTALLAS  *
    740 '****************
    750 COSA=INT (RND*5)+1:GOSUB 2290
    760 INK 0,0:INK 1,0:INK 2,0:INK 3,0:INK 4,0:INK 5,0:INK 6,0:INK 7,0:INK 8,0:INK 9,0:INK 10,0:CLS #4
    770 ENV 1,15,1,1:ENT 1,15,1,1:ENV 2,15,-1,1:RESTORE 800
    780 READ Nx,Dx:IF Nx=-1 THEN 810 ELSE SOUND 4,Nx,Dx*6,5,5
    790 GOTO 780
    800 DATA 95,4,106,4,119,4,106,4,95,8,-1,-1
    810 POKE &80C5,&7E:POKE &80C8,&20
    820 IF DY=0 THEN RESTORE 980
    830 IF DY=-1 THEN RESTORE 1010
    840 IF DY=1 THEN RESTORE 1030
    850 IF (DY=2 OR DY=7)THEN RESTORE 1060
    860 IF (DY=3 OR DY=8 OR DY=9)THEN RESTORE 1110
    870 IF DY=4 THEN RESTORE 1030
    880 IF DY=5 THEN RESTORE 1120
    890 IF DY=6 THEN RESTORE 1140
    900 IF (DY=10 OR DY=11) THEN RESTORE 1200
    910 IF DY=12 THEN RESTORE 1150
    920 IF HABIT=1 AND DY<>12 THEN RESTORE 1080
    930 IF HABIT=1 AND DY=12 THEN RESTORE 1170
    940 READ q,w,gr
    950 |ON,gr,q,w
    960 IF q=-1 THEN INK 1,10:INK 2,26:INK 3,6:INK 4,11:INK 5,24:INK 6,1:INK 7,15:INK 8,2:INK 9,3:INK 10,9:GOTO 1470
    970 GOTO 940
    980 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,2
    6,44,&8150,42,44,&8150,85,47,&84fd,79,28,&82d4,78,46,&82d4,78,64,&82d4,94,64,&82d4,94,46,&82d4,95,28,&82d4,110,64,&82d4
    990 DATA 110,46,&86e5,109,22,&82d4,122,64,&82d4,122,46,&82d4,122,28,&82d4,67,72,&861f,134,72,&8661,80,72,&86a3,96,72,&86a3,111,72,&8
    6a3,123,72,&86a3,74,80,&861f,83,88,&861f,127,80,&8661,119,88,&8661,86,80,&86a3,96,80,&86a3,110,80,&86a3,93,88,&86a3
    1000 DATA 106,88,&86a3,122,88,&82d4,122,100,&82d4,15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,114,&87af,-1,170,&87af
    1010 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,
    27,44,&8150,42,44,&8150,99,44,&8150,114,44,&8150,4,29,&82d4,4,47,&82d4,4,65,&82d4,4,83,&82d4,4,101,&82d4
    1020 DATA 4,113,&82d4,4,131,&82d4,15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,114,&87af,-1,170,&87af
    1030 DATA 4,11,&893e,20,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,85,46,&84fd,79,28,&82d4,
    78,46,&82d4,79,64,&82d4,78,82,&82d4,75,100,&82d4,71,118,&82d4,91,100,&82d4,95,82,&82d4,94,64,&82d4
    1040 DATA 95,46,&82d4,94,28,&82d4,99,100,&82d4,102,117,&82d4,71,129,&861f,78,137,&861f,82,141,&861f,103,128,&8661,95,136,&8661,90,14
    0,&8661,87,125,&86e5,86,131,&86a3,71,121,&86a3,102,121,&86a3,111,70,&86a3,118,70,&8661,118,64,&82d4,103,64,&82d4
    1050 DATA 110,48,&86e5,122,46,&82d4,111,22,&82d4,123,28,&82d4,123,54,&8661,15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,1
    14,&87af,-1,170,&87af
    1060 DATA 99,44,&8150,114,44,&8150,26,44,&8150,42,44,&8150,4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97
    ,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,114,&87af
    1070 DATA -1,170,&87af
    1080 DATA 22,19,&82d4,38,19,&82d4,55,19,&82d4,71,19,&82d4,86,19,&82d4,102,19,&82d4,7,19,&82d4,40,55,&84fd,119,19,&82d4,118,37,&82d4,
    119,55,&82d4,118,73,&82d4,102,73,&82d4,86,73,&82d4,71,73,&82d4,54,73,&82d4,38,73,&82d4,23,73,&82d4,7,73,&82d4,7,55,&82d4,7
    1090 DATA 37,&82d4,95,35,&8aa0,80,35,&8aa0,135,20,&893e,140,20,&893e,134,11,&893e,4,13,&893e,4,11,&893e,4,20,&893e,113,91,&82d4,112,
    109,&82d4,112,121,&82d4,130,81,&8661,123,89,&8661,115,97,&8661,98,96,&86a3,83,96,&86a3,69,96,&86a3,57,96,&86a3,45,96,&86a3
    1100 DATA 140,11,&893e,10,96,&861f,4,90,&861f,28,96,&86a3,25,96,&86a3,4,82,&86a3,-1,170,&87af
    1110 DATA 4,11,&893e,20,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87a
    f,140,114,&87af,-1,170,&87af
    1120 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,
    92,83,&82d4,92,101,&82d4
    1130 DATA 92,113,&82d4,92,131,&82d4,15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,114,&87af,-1,170,&87af
    1140 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,
    15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,114,&87af,36,34,&8990,66,34,&8990,97,34,&8990,-1,170,&87af
    1150 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,
    15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,47,&84fd,125,29,&82d4,124,47,&82d4,140,65,&82d4
    1160 DATA 125,65,&82d4,140,83,&82d4,124,83,&82d4,140,109,&86e5,125,101,&82d4,125,119,&82d4,124,137,&82d4,140,125,&82d4,140,137,&82d4
    ,-1,170,&87af
    1170 DATA 4,66,&82d4,5,84,&82d4,4,102,&82d4,4,120,&82d4,4,138,&82d4,5,48,&82d4,4,30,&82d4,139,66,&82d4,139,84,&82d4,139,102,&82d4,13
    9,120,&82d4,139,138,&82d4,139,48,&82d4,139,30,&82d4,20,28,&825a,36,28,&825a,51,28,&825a,100,28,&825a,113,28,&825a
    1180 DATA 128,28,&825a,24,64,&84fd,20,74,&825a,36,74,&825a,50,74,&825a,100,74,&825a,116,74,&825a,128,74,&825a,21,123,&825a,37,123,&8
    25a,50,123,&825a,100,124,&825a,117,124,&825a,128,124,&825a,107,90,&8aa0,120,90,&8aa0,75,92,&8801,33,106,&86e5
    1190 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,
    -1,170,&87af
    1200 DATA 4,11,&893e,20,11,&893e,36,11,&893e,51,11,&893e,66,11,&893e,82,11,&893e,97,11,&893e,111,11,&893e,126,11,&893e,140,11,&893e,
    15,107,&87af,22,103,&87af,27,106,&87af,53,123,&87af,140,114,&87af,-1,170,&87af
    1210 '*****************
    1220 '*  MOVIMIENTO  *
    1230 '*      &      *
    1240 '*  CONDICIONES  *
    1250 '*****************
    1260 IF INKEY(1)=0 AND t=1 THEN dir=1:GOSUB 1630
    1270 IF INKEY(8)=0 AND t=1 THEN dir=2:GOSUB 1640
    1280 IF INKEY(2)=0 AND y<ALT AND t=1 THEN dir=0
    1290 IF INKEY(0)=0 THEN ty=3
    1300 IF INKEY(47)=0 THEN fH=1:GOSUB 1540
    1310 IF D=50 THEN D=0:RA=INT(RND*3)+1
    1320 IF ty=3 THEN GOSUB 2470
    1330 IF DY=0 THEN GOSUB 1910
    1340 IF DY=12 AND HABIT=0 THEN GOSUB 2540
    1350 IF DY=12 AND HABIT=1 THEN GOSUB 2020
    1360 IF HABIT=0 THEN GOSUB 2170
    1370 IF DY=DIRE AND ob=0 AND HABIT=HA THEN |OFF:|ON,GRAF,XA,YA:ob=1:obb=0:GOTO 1470
    1380 IF DY=DIRE AND obb=0 AND x>90 AND x<110 AND HABIT=HA AND y+20>YA THEN obb=1:TESF=1:GOTO 2400
    1390 IF dir=1 THEN x=x+3
    1400 IF dir=2 THEN x=x-3
    1410 IF x<4 THEN x=143:DY=DY-1:fH=1:CLS #3:GOTO 760
    1420 IF x>145 THEN x=5:DY=DY+1:fH=1:CLS #3:GOTO 760
    1430 IF HABIT=1 THEN GOSUB 1950
    1440 IF LI=0 THEN 2690
    1450 |PUTSPRITE,x,y
    1460 GOTO 1260
    1470 IF dir=1 THEN |ON,&8366,x,y
    1480 IF dir=2 THEN |ON,&8441,x,y
    1490 IF dir=0 THEN |ON,&8366,x,y
    1500 IF DY=0 AND X>66 THEN POKE &80C5,&1A:POKE &80C8,&28
    1510 IF DY=0 AND X<65 THEN POKE &80C5,&7E:POKE &80C8,&20
    1520 IF HABIT=1 THEN  POKE &80C5,&1A:POKE &80C8,&28
    1530 GOTO 1260
    1540 IF x<14 THEN POSS=1
    1550 IF x>70 AND x<95 THEN POSS=2
    1560 IF x>142 THEN POSS=3
    1570 IF x>36 AND x<45 THEN POSS=4
    1580 IF (DY=0 OR DY=1 OR DY=4)AND HABIT=0 AND POSS=2 AND dir=0 THEN HABIT=1:CLS #3:y=51:ALT=52:SU=0:x=40:GOTO 760
    1590 IF HABIT=1 AND POSS=4 AND dir=0 THEN HABIT=0:CLS #3:y=43:ALT=44:x=89:SU=20:GOTO 760
    1600 IF DY=12 AND HABIT=0 AND x>135 THEN HABIT=1:CLS #3:y=60:x=42:ALT=60:SU=30:GOTO 760
    1610 IF DY=12 AND HABIT=1 AND x<32 AND y<62 THEN HABIT=0:CLS #3:y=43:ALT=44:x=134:SU=20:GOTO 760
    1620 RETURN
    1630 |OFF:|ON,&8366,x,y:RETURN
    1640 |OFF:|ON,&8441,x,y:RETURN
    1650 ENV 2,1,14,1,14,-1,20:SOUND 4,0,0,0,2,0,15:OUT &BC00,8:OUT &BD00,1:FOR Z=1 TO 26:INK 1,Z:BORDER Z:FOR YY=1 TO 50:NEXT YY,Z:OUT
    &BC00,8:OUT &BD00,0:INK 0,0:BORDER 3:INK 1,10
    1660 IF RA=1 THEN PLOT 600,200:DRAW 580,180,0:DRAW 600,40
    1670 IF RA=2 THEN PLOT 256,220:DRAW 200,180,0:DRAW 256,40
    1680 IF RA=3 THEN PLOT 96,170:DRAW 110,160,0:DRAW 80,40
    1690 IF RA2=1 AND x>54 AND x<73 THEN 1860
    1700 IF RA3=1 AND x>135 THEN 1860
    1710 IF RA1=1 AND x<18 THEN 1860
    1720 RA1=0:RA2=0:RA3=0:RA=0:GOTO 1260
    1730 PA1$="MAMA MONGUI DICE :"
    1740 PA2$="  VETE Y TRAE EL QUESOPARA LOS MACARRONES."
    1750 PA3$="  TRAE EL CHORIZO PARALOS MACARRONES."
    1760 PA4$="  TRAE EL HUEVO."
    1770 PA5$="  TRAE EL TENEDOR."
    1780 IF DY=0 AND PASA=1 THEN cde$=PA1$+PA2$:ob=0
    1790 IF DY=0 AND PASA=3 THEN cde$=PA1$+PA3$:ob=0
    1800 IF DY=0 AND PASA=5 THEN cde$=PA1$+PA4$:ob=0
    1810 IF DY=0 AND PASA=7 THEN cde$=PA1$+PA5$:ob=0
    1820 IF DY=0 AND PASA=9 THEN 2630
    1830 LOCATE 1,5:PEN 14:PRINT cde$
    1840 TU=1:GOTO 1260
    1850 |OFF:|ON,&8366,x,y:|OFF:|ON,&8366,GU,22
    1860 LI=LI-1:PEN 13:LOCATE 8,3:PRINT LI
    1870 SOUND 1,1000,15,13:SOUND 2,3000,30,15
    1880 IF DY<>12 THEN x=20
    1890 IF DY=12 THEN x=40
    1900 |OFF::RA1=0:RA2=0:RA3=0:GOTO 1470
    1910 IF X>66 THEN POKE &80C5,&1A:POKE &80C8,&28
    1920 IF X<65 THEN POKE &80C5,&7E:POKE &80C8,&20
    1930 IF HABIT=1 THEN POKE &80C5,&1A:POKE &80C8,&28
    1940 RETURN
    1950 IF x>107 AND DY<>12 THEN x=107
    1960 IF fH=1 THEN POKE &80C5,&1A:POKE &80C8,&28:fH=0
    1970 IF x>122 AND DY=12 THEN x=122
    1980 IF x<23 THEN x=23
    1990 IF DY=0 AND TU=0 THEN 1730
    2000 IF DY=0 AND FF=1 THEN SC=SC+50:FF=0:TESF=0:GOTO 2400
    2010 RETURN
    2020 IF x=122 AND HABIT=1 AND y<80 THEN SU=50
    2030 IF x>94 AND HABIT=1 AND y<100 THEN POKE &80C5,&7E:POKE &80C8,&20
    2040 IF x<94 AND HABIT=1 THEN POKE &80C5,&1A:POKE &80C8,&28
    2050 IF x<>122 AND HABIT=1 AND DY=12 THEN SU=30
    2060 IF x<>122 AND HABIT=1 THEN SU=15
    2070 IF y=106 AND HABIT=1 THEN ALT=106
    2080 IF y<90 THEN POKE &80C5,&1A:POKE &80C8,&28
    2090 IF x>62 AND x<95 AND HABIT=1 AND ty=0 THEN GOSUB 2140
    2100 IF y<40 AND HABIT=1 THEN GU=60:GOTO 1850
    2110 IF ty=0 AND HABIT=1 AND y<100 THEN ALT=60
    2120 IF (x<62 OR x>95) AND HABIT=1 AND CA=1 THEN ty=3
    2130 RETURN
    2140 y=y-2:CA=1
    2150 IF y<40 AND HABIT=1 THEN y=60:GOTO 1850
    2160 RETURN
    2170 D=D+1
    2180 IF (DY=1 OR DY=3 OR DY=4 OR DY=8 OR DY=9 OR DY=10 OR DY=11) AND x>35 AND x<58 AND ty<>3 THEN GU=44:GOTO 1850
    2190 IF RA=1 THEN PLOT 600,200:DRAW 580,180,2:DRAW 600,40:RA3=1:GOTO 1650
    2200 IF RA=2 THEN PLOT 256,220:DRAW 200,180,2:DRAW 256,40:RA2=1:GOTO 1650
    2210 IF RA=3 THEN PLOT 96,170:DRAW 110,160,2:DRAW 80,40:RA1=1:GOTO 1650
    2220 IF (DY=1 OR DY=4)AND  fH=1 THEN POKE &80C5,&1A:POKE &80C8,&28:fH=0
    2230 IF DY=2 THEN GOSUB 1910
    2240 IF DY=-1 AND fH=1 THEN POKE &80C5,&1A:POKE &80C8,&28:fH=0
    2250 IF DY=-1 AND x<22 THEN x=22
    2260 IF (DY=3 OR DY=8 OR DY=9)AND x>121 AND ty<>3 THEN GU=128:GOTO 1850
    2270 IF DY=6 AND x>32 AND x<110 AND y<46 THEN 1860
    2280 RETURN
    2290 IF COSA=1 THEN DIRE=-1:HA=0:XA=100:YA=52
    2300 IF COSA=2 THEN DIRE=1:HA=1:XA=100:YA=52
    2310 IF COSA=3 THEN DIRE=4:HA=1:XA=100:YA=52
    2320 IF COSA=4 THEN DIRE=12:HA=1:XA=110:YA=104
    2330 IF COSA=5 THEN DIRE=6:HA=0:XA=100:YA=52
    2340 PASA=PASA+1
    2350 IF PASA=1 THEN GRAF=&88FB
    2360 IF PASA=3 THEN GRAF=&8A16
    2370 IF PASA=5 THEN GRAF=&8A34
    2380 IF PASA=7 THEN GRAF=&8A6E
    2390 RETURN
    2400 SC=SC+12:LOCATE 2,3:PEN 13:PRINT SC
    2410 IF SC>HS THEN HS=SC:LOCATE 16,3:PRINT HS
    2420 CLS #3:FF=1
    2430 IF TESF=1 THEN LOCATE 5,18:PEN 12:PAPER 0:PRINT"YA LO TIENES":LOCATE 4,19:PEN 13:PRINT"REGRESA A CASA"
    2440 IF TESF=0 THEN LOCATE 5,18:PEN 12:PAPER 0:PRINT"YA ERA HORA":FF=0:TU=0
    2450 GOSUB 2590
    2460 CLS #3:PAPER 11:GOTO 750
    2470 IF ty=3 AND dir<>0 THEN y=y+(pu)+1
    2480 IF RA2=1 AND x>54 AND x<73 THEN 1860
    2490 IF RA3=1 AND x>135 THEN 1860
    2500 IF RA1=1 AND x<18 THEN 1860
    2510 IF y>ALT+SU AND ty=3 THEN pu=-2
    2520 IF y<ALT AND ty=3 THEN pu=1:ty=0:CA=0
    2530 RETURN
    2540 IF HABIT=0 THEN CA=0
    2550 IF RA<30 THEN RA=40
    2560 IF x>140 THEN x=140:dir=0
    2570 IF fH=1 THEN POKE &80C5,&1A:POKE &80C8,&28:fH=0
    2580 RETURN
    2590 ENV 1,15,1,1:ENT 1,15,1,1:ENV 2,15,-1,1:RESTORE 2620
    2600 READ N,D:IF N=-1 THEN RETURN ELSE SOUND 4,N,D*6,10,5
    2610 GOTO 2600
    2620 DATA 95,4,106,4,119,4,106,4,95,8,106,2,119,2,127,2,142,4,159,4,142,4,127,8,142,2,159,2,179,2,190,4,159,4,119,4,127,4,106,4,80,4
    ,95,16,-1,-1
    2630 CLS #3:LOCATE 5,14:PEN 12:PAPER 0:PRINT"YA ERA HORA":LOCATE 3,16:PEN 14:PRINT"PERO YA NO QUIERO":LOCATE 8,18:PEN 15:PRINT"COMER
    "
    2640 FOR Z=1 TO 5000:NEXT
    2650 FOR Z=25 TO 40:LOCATE #3,1,25:PRINT #3," ":NEXT
    2660 TES$="      PROGRAMA        Oscar Valladares        EDITA          Amstrad User              1988"
    2670 LOCATE #3,1,25:PRINT #3,TES$
    2680 FOR z=1 TO 3000:NEXT:FOR z=25 TO 40:LOCATE #3,1,25:PRINT #3," ":NEXT
    2690 CLS #3:LOCATE 8,16:PEN 12:PAPER 0:PRINT"G A M E":LOCATE 8,18:PEN 14:PRINT"O V E R":FOR z=1 TO 3000:NEXT:CLS #3:PAPER 11
    2700 GOTO 700
    avatar
    Dinoneno


    Posts : 10
    Join date : 2012-03-11

    custom RSX commands Empty Re: custom RSX commands

    Post  Dinoneno Tue Mar 27, 2012 5:29 pm

    Of course, it's possible, but considering the distribution of memory used by CPC Basic: from &0170 to &3FFF is internal work area, from &4000 to & 4000+<length of program>-1 is occupied by the program and variables. From this address can be put machine code, RSX or any other data, to the address where the stack starts (approximately &AF00 I think, surely I'm wrong).

    To find the length of the program can be used HIMEM function, which gives the last byte used by the program, and in address HIMEM+1 you can enter any information in memory without problem.

    You can also compile the program with output type Binary and observe the .bin file length generated. Then begin to free memory is &4000+<.bin file length>.

    The binary file generated by the program MONGUI has aproximately length of 23000 bytes. If you add &4000 + &59D8 (= 23000), it's &99D8. So, as the code inserted for the RSX commands is over &8000 and next, it's not possible. It's necessary relocalize the code in &99D8 or more.
    avatar
    poppichicken


    Posts : 16
    Join date : 2012-03-16

    custom RSX commands Empty Re: custom RSX commands

    Post  poppichicken Tue Mar 27, 2012 5:32 pm

    Ah, I see.
    Thanks!

    Sponsored content


    custom RSX commands Empty Re: custom RSX commands

    Post  Sponsored content


      Current date/time is Thu Nov 21, 2024 9:45 pm