Jump to content
IGNORED

The "funkheld" Question Thread


funkheld

Recommended Posts

Not sure about FastBasic but with standard Atari Basic USR calls you need at least one PLA at the start.

You've got 2 x PHA which is sort of pointless.

 

Once you've done the PLA, A should contain the # of parameters that the USR call has passed.

It's up to you whether you want to do complex parsing that can handle any number, or just expect a particular number of parms (or none) which will probably crash if not called in the expected way.

Parameters are 16 bit numbers so you need 2 x PLA to retrieve each one.

 

Generally with any Basic, there's no need to save/restore registers, the Basic interpreter will take care of that itself.

Edited by Rybags
Link to comment
Share on other sites

if you have new ideas for the extension?

You invented a wonderful Basic.


I am also looking for a solution for the Fastbasic for the VBI?


I also have a problem here, it does not work:






.global PRINTE

.proc PRINTE
ldx #0
lda #32
loop
sta $2100,x
inx
bne loop
lda #0
ldx #0
rts
.endproc


Edited by funkheld
Link to comment
Share on other sites

Hi!

 

if you have new ideas for the extension?

You invented a wonderful Basic.

 

I am also looking for a solution for the Fastbasic for the VBI?

What do you want the VBI for?

 

For BASIC programs, normally you simply use "PAUSE 0" to wait for VBI, then you can write all registers without tearing.

 

See:

 repeat : pause 0 : poke 53274, 127 : until key()

I also have a problem here, it does not work:

 

 


.global PRINTE
 
.proc PRINTE
  ldx #0
  lda #32
loop 
  sta $2100,x
  inx
  bne loop
  lda #0
  ldx #0
  rts
.endproc

 

That should work only if you change the start-address, it writes the value "32" to memory locations from $2100 to $21FF.

Link to comment
Share on other sites

Hi good afternoon.
what does the parser error mean?
Thank you.
greeting

 

 

dlist =560
savmsc=$58
ramadr=$2100
 
data dldat() byte = $70, $70, $70, $46, 
data          byte = $00,$21,
data          byte = $80, $06, $06, $06, $60, $06, $06, $06, $06, $06,
data          byte = $06, $06, $06, $06, $60, $06, $06, $06, $06, $06, 
data          byte = $06, $06, $06, $41, $00, $20 
 
dladr=adr(dldat)
move dladr,$2000,255
 
dpoke dlist,$2000
dpoke savmsc,ramadr
 
for i= ramadr to ramadr+439
poke i,32
next i
 
pause 0
 
poke $20fe,0
 
dpoke 512, @dlizeile1
poke 54286, 192  
 
z=$2007
 
repeat
  get a
  pause 0
  poke z,$80
  poke z-1,$06  
  
  z=z+1
  
  if z=$201a then
    z=$2007
  endif
until 0
 
end

post-31221-0-53452900-1538900131_thumb.jpg

Link to comment
Share on other sites

Hi good afternoon.

I need a memory allocation of

madpascal.


why do I have to put the pm-memory always so low (256 * 106-4) although in graph8 there is so much space for the pm?


the memory principle of madpascal is incomprehensible to me.


Thank you.

greeting






uses crt, graph, joystick;

const
_max = 7; // Number of player 0 data values
_speed = 16; // Player 0 movement speed

var
p0Data : array [0.._max] of byte = (48,120,252,48,48,48,48,48); // Draw player 0 image
px0 : byte = 120; // Sprite X position
py0 : byte = 60; // Sprite Y position
pmgMem : Word;

procedure moveSprite;
begin

Poke(pmgMem+512+py0-1, 0);
Poke(pmgMem+512+py0+_max+1, 0);

move(p0Data, pointer(pmgMem+512+py0), sizeof(p0Data));

end;


begin
// Set graphics mode and playfield colors
InitGraph(;

Poke(710, 122); Poke(712, 130);
Poke(709, 64);

// Set playfield graphics
SetColor(1);
Line(10,10,300,10);

Rectangle(30,50,100,130);

Circle(250,60,20);

// Initialize P/M graphics
Poke(53277, 0);
pmgMem := Peek(106) - 4;
Poke(54279, pmgMem);
pmgMem := pmgMem shl 8;
Poke(559, 46);

// Clear player 0 memory
fillchar(pointer(pmgMem+512), 128, 0);

// Draw player 0

// Vertical position of player 0
moveSprite;

Poke(53277,3); // Turn on P/M graphics
Poke(53256,0); // Size of player 0 (normal size)
Poke(704,44); // Player 0 color
Poke(53248,px0); // Horizontal position of player 0

repeat

case joy_1 of

joy_left:
begin // Move player 0 left
Dec(px0);
if px0 < 45 then px0 := 45;
Poke(53248,px0);
Delay(_speed);
end;

joy_right:
begin // Move player 0 right
Inc(px0);
if px0 > 203 then px0 := 203;
Poke(53248,px0);
Delay(_speed);
end;

joy_up:
begin // Move player 0 up
Dec(py0);
if py0 < 16 then py0 := 16;

moveSprite;
Delay(_speed);
end;

joy_down:
begin // Move player 0 down
Inc(py0);
if py0 > 97 then py0 := 97;

moveSprite;
Delay(_speed);
end;

end;

until keypressed;
// Reset P/M graphics
InitGraph(0);
Poke(53277, 0);
end.

Edited by funkheld
Link to comment
Share on other sites

*.a65 file

STACKWIDTH = 16
CODEORIGIN = $2000
 
TRUE = 1
FALSE = 0
 
org $80
 
.print 'ZPFREE: $0000..',*-1
 
fxptr .ds 2
 
eax .ds 4 ;8 bytes (aex + edx) -> divREAL
edx .ds 4
ecx .ds 4
bp .ds 2
bp2 .ds 2
 
ztmp
ztmp8 .ds 1
ztmp9 .ds 1
ztmp10 .ds 1
ztmp11 .ds 1
 
TMP .ds 2
 
STACKORIGIN .ds STACKWIDTH*4
 
.print 'ZPFREE: ',*,'..',$ff
 
ax = eax
al = eax
ah = eax+1
 
cx = ecx
cl = ecx
ch = ecx+1
 
dx = edx
dl = edx
dh = edx+1
 
org eax
 
FP1MAN0 .ds 1
FP1MAN1 .ds 1
FP1MAN2 .ds 1
FP1MAN3 .ds 1
 
org ztmp8
 
FP1SGN .ds 1
FP1EXP .ds 1
 
org edx
 
FP2MAN0 .ds 1
FP2MAN1 .ds 1
FP2MAN2 .ds 1
FP2MAN3 .ds 1
 
org ztmp10
 
FP2SGN .ds 1
FP2EXP .ds 1
 
org ecx
 
FPMAN0 .ds 1
FPMAN1 .ds 1
FPMAN2 .ds 1
FPMAN3 .ds 1
 
org bp2
 
FPSGN .ds 1
FPEXP .ds 1
 
; -----------------------------------------------------------
 
org CODEORIGIN
 
STATICDATA
 
START

try

Mad Pascal Compiler
Syntax: mp <inputfile> [options]
-d              Diagnostics mode
-code:$address  Code origin address
-data:$address  Data origin address
-stack:$address Software stack address (size = 64 bytes)
-zpage:$address Address variables on the zero page (size = 24 bytes)
Edited by tebe
Link to comment
Share on other sites

Hi good afternoon.


readkey outputs the most impossible values with Altirra with madpas.

why is that please?

what needs to be done here?


greeting


uses crt;

var
s: char;
a: byte;
quit: boolean;

begin
repeat
begin
s := ReadKey;
a:=byte(s);
writeln(a);
end;
until quit;
end.

Edited by funkheld
Link to comment
Share on other sites

They do not work according to the table.

greeting


test:


e = 12

i = 228

k = 208


W = 1

E = 208

R = 63

........

........




uses crt;

var
s: char;
a: byte;
quit: boolean;

begin
repeat
begin
s := readkey;
a:=byte(s);

writeln(a);
end;

until quit;
end.


Edited by funkheld
Link to comment
Share on other sites

The ReadKey routine (which uses GetKey) is translating the keycode using the O/S lookup table via the address at ($79).w which points in the XL O/S to $FB51

 

Have you switched out the O/S or altered the content of $79 or $7A?

 

[Edit] your listing works fine for me; pressing A,B,C,D,space,a,b,c,d results in 65, 66, 67, 68, 32, 97, 98, 99, 100

Edited by Wrathchild
Link to comment
Share on other sites

I'm guessing he is running on a 400/800 OS. The pointer at $79 doesn't exist on OS-B and the values reported are consistent with the GetKey routine breaking as a result (which is why I consider it a bad idea to rely on this pointer or the OS key table in general).

  • Like 1
Link to comment
Share on other sites

It's not good practice to rely on either method. In 95% or more of cases if you know it's not an XL you could probably refer to the fixed location table in the old OS.
But there's no guarantee if a custom OS is in use.
So you'd need to cater for both, which in practical use means just supply your own translation table.

You can do it in 64 bytes - the Shift and Ctrl variants are just bitsettings.

Link to comment
Share on other sites

You can do it in 64 bytes - the Shift and Ctrl variants are just bitsettings.

192 bytes, I think. Certain POKEY key codes (like the whole alphabet) can easily be mapped to the appropriate ATASCII codes in an algorithmic fashion using a 64 byte table as a base, but I guess there's a reason they used a look up table for shift and control when you consider the rest (shifted numbers, cursor control, etc).

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...