Тёмный
No video :(

#52 - Z80 Machine Code in 20 Minutes (Sinclair ZX Spectrum / Next) 

Spriteworx
Подписаться 1,6 тыс.
Просмотров 3,5 тыс.
50% 1

A quick and not-too-dirty BASIC loader program for learning z80 assembly language & machine code on the Sinclair Spectrum or ZX Spectrum Next.
PROGRAM:
10 REM [A simple BASIC program to save and execute a machine code program in memory]
20 RESTORE 9000: REM [Refresh DATA]
30 CLS:REM [Clear the display]
40 PRINT "Press a key to load M.C program"
50 PAUSE 0: REM [Wait for user to press a key]
60 LET memory=40000: REM [Initialize "memory" variable to store address locations for MC]
100 READ i$: REM [Read z80 assembly instruction description]
110 PRINT 'i$,: REM [Print z80 assembly instruction]
120 READ bytenum: REM [Read number of MC bytes for instruction]
130 PRINT "Bytes: ";bytenum
140 for f=1 to bytenum: REM [Set loop counter for number of bytes]
150 READ byte: REM [Read a MC byte into the variable "byte"]
160 POKE memory, byte : REM [Save MC byte to memory address]
170 PRINT memory, PEEK (memory): REM [Print memory address and MC byte]
180 IF byte=201 THEN GOTO 1000: REM [Check for RETURN instruction (201)]
190 LET memory=memory+1: REM [Incrememt memory address]
200 NEXT f: REM [Go read next MC byte]
210 PRINT '"Press a key for next instruction"
220 PAUSE 0: REM [Wait for user input]
230 GOTO 100: REM [Go read next z80 instruction]
1000 PRINT '"Press any key to execute M.C."
1010 PAUSE 0: REM [Wait for user input]
1020 RANDOMIZE usr 40000: REM [Execute MC program (stored at address 40000)]
8999 STOP: REM [End program once MC has finished executing]
9000 REM [MACHINE CODE BYTES BELOW]
9001 DATA "LD A,2",2,62,2:REM [Load border color (red) into register A]
9002 DATA "OUT (254),A",2,211,254:REM [Set border to color stored in register A]
9003 DATA "RETURN",1,201:REM [Return to BASIC]
===========================
Download Spriteworx games at:
spriteworx.itc...
Join my free Spriteworx Facebook Page (public):
/ spriteworx
Help support more projects by becoming a Patreon subscriber:
/ spriteworx
Private facebook group with downloadable content for Patreon subscribers:
/ spriteworx

Опубликовано:

 

26 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 9   
@Auberge79
@Auberge79 4 месяца назад
I remember writing BASIC program back in 1994 or around that year. I needed a picture to be moved from memory into screen memory so I user a small machine code program consisting of one command ;-) I simply POKEd those bytes into free part of memory straight from BASIC and used RANDOMIZE USR 'some addredd I don't remember' to make that. The machine code program was LDIR, which moved some bytes of memory (6912, quantity according to one of CPU registers) from starting address indicated in another register to 16384, stated in third register. This was way more fast then PEEKing and POKEing 6912 byted in cycle of BASIC :-)
@Matefromthepast
@Matefromthepast 2 года назад
Glad you're back!
@Spriteworx
@Spriteworx 2 года назад
Cheers!
@tobobobo5489
@tobobobo5489 Год назад
That was actually very helpful. Thank you.
@lostcarpark
@lostcarpark 2 года назад
An interesting video, but the title is a bit misleading, since it doesn't go into very much detail on assembly language or machine code. I know you do state that in the intro. I'd like to see a rapid fire tour of the Z80 instruction set.
@Hamomim1
@Hamomim1 2 года назад
thank you
@cprince10
@cprince10 10 месяцев назад
Great video. If I draw a box using Plot and Draw, how do I fill in the box with colour?
@lawrencemanning
@lawrencemanning 2 года назад
I like your videos but IMO you can and should explain the difference between assembly and machine code very simply: machine code is the binary stream of instructions read and executed by the processor, assembly is a convenient human readable representation of those machine code instructions. An “Assembler” is normally a program, but here you have assembled the assembly stream into machine code, but you’ve still assembled assembly into machine code, just by hand. It’s a bit muddled here. IMO this video would have been clearer and less “fluffy” if you’d sat down with pen, paper and a Z80 instruction table and assembled the program by hand and then loaded it with POKEs. Then you could have talked about other ways to get machine code into the Speccy’s memory. Just trying to help. :)
@2kBofFun
@2kBofFun Год назад
Assembly is a half-readable representation, just as garbled as the incredible shitty word mnenomics is. I made a custom assembler that is way more readable, and the instructions in this video would read "A=2", "P(254)=A" and "return"
Далее
ПАВЕЛ ДУРОВ АРЕСТОВАН
1:45:21
Просмотров 113 тыс.
The Z80's secret feature discovered after 40 years!
16:07
ZX Spectrum Jetpac - Game Deconstruction
14:56
Просмотров 14 тыс.
#25: Z80 Assembly Language Tutorial (ZX Spectrum Game)
1:34:47