ZX81 emulators with built-in assembler... or...?

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
User avatar
TMD2003
Posts: 149
Joined: Sun Oct 11, 2020 5:39 pm

Re: ZX81 emulators with built-in assembler... or...?

Post by TMD2003 »

dr beep wrote: Sat Dec 11, 2021 9:31 am When you start MC (best not to return to BASIC) a simple RND routine can be coded better than use of ROM. I have several.
Bring them on.

Alternatively, I have (on the Spectrum at least) analysed the RND function, isolating all five of the bytes. Apparently the result gets dumped on the calculator stack. One of the bytes makes an almost-consistent random number between 0 and 127 (even if the RND function ensures that there are 65536 values all with an equal probability). If I had a CALL ... to the ROM and then knew where the result was, I could look at it that way.

I may have the ZX81 ROM disassembly somewhere.

And now, I have *another* awful CSSCGC entry to score. It's not Crayon, but it's close.
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: ZX81 emulators with built-in assembler... or...?

Post by dr beep »

TMD2003 wrote: Sat Dec 11, 2021 2:54 pm
dr beep wrote: Sat Dec 11, 2021 9:31 am When you start MC (best not to return to BASIC) a simple RND routine can be coded better than use of ROM. I have several.
Bring them on.

Alternatively, I have (on the Spectrum at least) analysed the RND function, isolating all five of the bytes. Apparently the result gets dumped on the calculator stack. One of the bytes makes an almost-consistent random number between 0 and 127 (even if the RND function ensures that there are 65536 values all with an equal probability). If I had a CALL ... to the ROM and then knew where the result was, I could look at it that way.

I may have the ZX81 ROM disassembly somewhere.

And now, I have *another* awful CSSCGC entry to score. It's not Crayon, but it's close.
L holds range so this example is a die

Routine does some calculation and seed alters each loop, also timer is used as second parameter.

Code: Select all


rnd        LD   L,6
           LD   A,(frames)
rseed      ADD  A,1
           LD   H,A
           RRCA
           RRCA
           RRCA
           XOR  31
           ADD  A,H
           SBC  A,255
           LD   (rseed+1),A
subl       SUB  L
           JR   NC,subl
        ADC A,L RET
        
  
  
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: ZX81 emulators with built-in assembler... or...?

Post by dr beep »

Another option is to use the ROM as random generator

Read address 0, next 1 etc…. When 8192, go back to 0
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: ZX81 emulators with built-in assembler... or...?

Post by mrtinb »

mrtinb wrote: Fri Dec 10, 2021 10:31 am The template for NO$ZX is tricking me a little, but maybe you should try the online JSZeddy emulator, which has built-in assembler.
So the template I've got so far for NO$ZX is below. There is an error in it, because I cannot get it to autostart. But it's the best I can do for the time being. Good luck.

Code: Select all

.z80
org 16393

;===================
; Header. Don't edit
;===================
db 000h, 002h, 000h

dfileptr: dw dfile

db 0a4h, 040h

vars: dw last

db 000h, 000h

eline: dw afterlast

db 0c5h, 043h, 000h
db 000h, 0c6h, 043h, 0c6h, 043h, 000h, 05dh, 040h
db 000h, 002h, 000h, 000h, 0ffh, 0ffh, 0ffh, 037h
db 0a3h
nextline: dw dfile
db 000h, 000h, 000h, 000h, 08dh
db 00ch, 000h, 000h, 004h, 0bfh, 000h, 000h, 0bch
db 021h, 018h, 040h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 076h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 084h, 020h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h

line1: db 000h, 001h
linelength: dw line2-line1content
line1content:
db 0eah
;===========
; Header end
;===========

;==============
; Program start
;==============
prgstart:
  ld bc,0202h ;print pos 1,1
  call 08f5h  ;set cursor

  ld b,5      ;write 5 chars
again:
  push bc
  pop af
  rst 10h
  djnz again
  ret
;============
; Program end
;============

;=======
; Footer
;=======
db 076h
line2: db 000h, 0002h
line2length: db 00eh, 000h
randusr: db 0f9h, 0d4h, 01dh, 022h, 021h, 01dh
db 020h, 07eh, 08fh, 001h, 004h, 000h, 000h, 076h
dfile: db 076h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 076h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 076h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 076h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 076h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 076h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 076h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 076h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 076h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 076h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 076h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 076h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 076h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 076h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 076h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 076h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 076h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 076h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 076h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 076h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 076h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 076h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 076h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 076h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h
db 000h, 000h, 000h, 000h, 076h

last: db 080h
afterlast:
end
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Spinnetti
Posts: 255
Joined: Sat Sep 12, 2020 11:29 pm

Re: ZX81 emulators with built-in assembler... or...?

Post by Spinnetti »

Why constrain yourself with rem statements? I use FASM-ZX which is super basic, no fancy stuff at all, but works great, then just run it with EightyOne. No Rems or basic required.
Zeddy: ZX80, ZX81/ZXpand, TS1000/ZXpand, TS1500/Zxpand+,Printer
Speccy: 48k, +, +2, +3, TS2068, "Bare Metal" Pi, Next KS2, IF1/Microdrives/Vdrive/Light Gun/VGA-Joy
QL: Minerva/QL-VGA/Custom PSU
C5: 24v, LiFE battery, Disc brakes
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: ZX81 emulators with built-in assembler... or...?

Post by mrtinb »

Well NO$ZX has emulator, assembler and debugger in one package, so that's why it was suggested. The built-in directives does not include a Basic REM statement, but uses pure machine code as you suggest. I made the template, as a REM statement was requested

However as we say earlier in the thread, JSZeddy might fit the development cycle even better.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
Spinnetti
Posts: 255
Joined: Sat Sep 12, 2020 11:29 pm

Re: ZX81 emulators with built-in assembler... or...?

Post by Spinnetti »

I see. thanks.
Zeddy: ZX80, ZX81/ZXpand, TS1000/ZXpand, TS1500/Zxpand+,Printer
Speccy: 48k, +, +2, +3, TS2068, "Bare Metal" Pi, Next KS2, IF1/Microdrives/Vdrive/Light Gun/VGA-Joy
QL: Minerva/QL-VGA/Custom PSU
C5: 24v, LiFE battery, Disc brakes
Post Reply