1K lowres games in machinecode on a Lambda

Software and Games for the Lambda 8300 / Power 3000 Computer
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

1K lowres games in machinecode on a Lambda

Post by David G »

Perhaps not too difficult to do. The dfile is fixed at 407Dh, so that's a main change to a game that allows it to run on the Lambda

But what about using the maximum RAM by coding over the System Variables? Devilishly tricky

Here is Game1 of Dr. Beeps gamecoding course
Game1 running on NO$ZX emulator
Game1 running on NO$ZX emulator
Well, kind of running. At least it found the BASIC line and creates a display

The first challenge is that the "next basic line" System Variable is changed on the Lambda to be where E_PPC is on a ZX81. Looks like the next challenge is to debug it. Does it not like the abbreviated dfile ending with E9? Or is just a simple typo somewhere?
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: 1K lowres games in machinecode on a Lambda

Post by mrtinb »

The most complex documentation I've found for the Lambda 8300 is in German:

https://airtable.com/shrXP65XwdIFSDVn3/ ... UoME2mOckk
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: 1K lowres games in machinecode on a Lambda

Post by mrtinb »

If you are interested in getting the real hardware, one just showed up on eBay:

https://www.ebay.de/itm/334468975000
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: 1K lowres games in machinecode on a Lambda

Post by David G »

wow, quite a book


These are necessary porting changes, similar to what I used on the Tasword port:

1. DFILE_ADDR is hardcoded to 407Dh (16393)

2. update critical System Variables. For the 1K game specifically:
PROGRAM (where D_FILE is on ZX81)
NXTLINE (where E_PPC is on ZX81)

3. keyword translation. The one BASIC line here only uses GOTO (no change) and USR (bytecode differs)
USR token = 212 (ZX81) 208 (Lambda)

4. the usual Lambda characters changes (most importantly colon and question mark characters), which are not used by the 1K game

5. ROM calls. 07BDh is called. This is DECODE which works totally different in the Lambda.rom
The DECODE routine can be copied from ZX81 ROM, but the KEY TABLES are fairly sizeable

Code: Select all

   DECODE:
        LD      D,0        
        SRA     B          
        SBC     A,A        
        OR      $26        
        LD      L,5        
        SUB     L          
   KEY_LINE:
        ADD     A,L        
        SCF                
        RR      C          
        JR      C,KEY_LINE 
        INC     C          
        RET     NZ         
        LD      C,B        
        DEC     L          
        LD      L,1        
        JR      NZ,KEY_LINE
        LD      HL,KEY_TABLES-1
        LD      E,A
        ADD     HL,DE      
        SCF                
        RET

KEY_TABLES:     ;only unshifted keys are tabled here to save space
;Unshifted 007E-00A4
          ; Z   X   C   V
   db     $3F,$3D,$28,$3B
      ; A   S   D   F   G
   db $26,$38,$29,$2B,$2C
      ; Q   W   E   R   T
   db $36,$3C,$2A,$37,$39
      ; 1   2   3   4   5
   db $1D,$1E,$1F,$20,$21
      ; 0   9   8   7   6
   db $1C,$25,$24,$23,$22
      ; P   O   I   U   Y
   db $35,$34,$2E,$3A,$3E
      ;N/L  L   K   J   H
   db $76,$31,$30,$2F,$2D
      ;[ ]  .   M   N   B
   db $00,$1B,$32,$33,$27
DECODE appears to be at $1489 (1489h) in Lambda.rom, but no success in calling it
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: 1K lowres games in machinecode on a Lambda

Post by David G »

the Lambda does not like the dfile "jp (hl)" method of ending a partial dfile. Even worse, as far as i can tell, it doesn't like partial lines, or a collapsed display file whatsoever

Which means many of the advanced 1K games won't fit in 1K on the Lambda


but is that a problem? The Lambda comes standard with 2K so all 1K games should run!
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: 1K lowres games in machinecode on a Lambda

Post by David G »

Yep. Updating dfile to use full-size works. Only had to modify the Up and Down routines to add/subtract 33 instead of 21


P file execution TESTED ON
  • NO$ZX v2.0 for Windows EMULATOR using setting 'LAMBDA 8300 (ZX81 revision)' with 2K
    (NO$ZX = nocash ZX emulator by Martin Korth)
  • EightyOne emulator 'Lambda 8300' with 32K & "Lambda.rom"
    This emulator doesn't boot with less than 32K
Attachments
Game1_010_Lambda_2K.p
(1.17 KiB) Downloaded 133 times
dr beep
Posts: 2076
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1K lowres games in machinecode on a Lambda

Post by dr beep »

David G wrote: Sat Jun 11, 2022 4:56 am the Lambda does not like the dfile "jp (hl)" method of ending a partial dfile. Even worse, as far as i can tell, it doesn't like partial lines, or a collapsed display file whatsoever

Which means many of the advanced 1K games won't fit in 1K on the Lambda


but is that a problem? The Lambda comes standard with 2K so all 1K games should run!
How does the Lambda react on "executable" opcodes on the screen, like LD B,B
These hidden commands are part of my games, like in SNAKEBINGO where these opcodes hide the direction the tail moves in. On MINESWEEPER with these opcodes information of the minefield is stored on the screen.
PATHMAZE has the whole maze hidden, just like HIDDEN PICTURE 1,2 and 3
David G
Posts: 387
Joined: Thu Jul 17, 2014 7:58 am
Location: 21 North, 156 West

Re: 1K lowres games in machinecode on a Lambda

Post by David G »

I will test. Can you provide sample code?
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: 1K lowres games in machinecode on a Lambda

Post by mrtinb »

Maybe the tests should be on real hardware, as most emulators for Lambda 8300 reuse ZX81 code, and change a few things to compensate for Lambda, maybe not knowing how the Lambda 8300 really works.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
mrtinb
Posts: 1910
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: 1K lowres games in machinecode on a Lambda

Post by mrtinb »

I’ve previously tested how executing code above 32k works. It works fine without M1NOT modification. So here the ULAs are quite different.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Post Reply