Cov txheej txheem:

Z80-mbc2 Z80 Code Flash User LED: 3 Kauj Ruam
Z80-mbc2 Z80 Code Flash User LED: 3 Kauj Ruam

Video: Z80-mbc2 Z80 Code Flash User LED: 3 Kauj Ruam

Video: Z80-mbc2 Z80 Code Flash User LED: 3 Kauj Ruam
Video: Build an 8-bit retro computer powered by a Z80 ! [Zeal 8-bit] 2024, Kaum ib hlis
Anonim
Z80-mbc2 Z80 Code Flash User LED
Z80-mbc2 Z80 Code Flash User LED

Nov yog qhov piv txwv cov neeg siv LED program sau rau hauv Z80 assembler rau z80-mbc2 computer.

Kuv tau ua qhov kev sim no thiab rov ua haujlwm rau kuv, qhov no yog kuv thawj Z80 txoj haujlwm ntau dua 35 xyoos.

Txaus siab rau

Khoom siv

Z80-mbc2 lub computer

Ib daim qauv ntawm Z80ASM los ntawm SLR Systems Rel. 1.32, rub tawm los ntawm ntau lub cp/m cov ntawv khaws tseg

Tus kws kho ntawv, Kuv siv ZDE16, vim nws twb nyob ntawm CP/M khau raj duab rau z80-mbc2

Kauj Ruam 1: Nruab Z80asm ntawm Koj Z80-mbc2

Nruab Z80asm ntawm Koj Z80-mbc2
Nruab Z80asm ntawm Koj Z80-mbc2

Kuv xav tias qee qhov paub nrog cov cuab yeej uas koj muaj rau koj Z80-MBC2, uas yog yam twg ntawm cpmtools koj siv. Nov yog cov theem yog tias siv cov kab hais kom ua kab ke:

  1. Tau txais cov ntaub ntawv z80asm.com thiab z80asm.doc (xaiv tau) hauv cov npe qee qhov chaw ntawm koj lub PC host
  2. Muab koj daim npav SD tso rau hauv tib lub PC, Kuv xav tias hais tias nws tau qhia raws li tsav E: hauv qab no.
  3. Kuv muab cov khoom sib dhos rau ntawm kuv CP/M disk A, rau cp/m 2.2 uas yuav yog daim duab duab DS0N00. DSK
  4. Qhov hais kom ua: cpmcp -f z80mbc2 -d0 e: DS0N00. DSK z80asm.com 0: yuav luam cov ntawv z80asm.com rau daim duab
  5. Cov lus txib cpmcp -f z80mbc2 -d0 e: DS0N00. DSK z80asm.doc 0: yuav luam cov ntaub ntawv mus rau disk (yeem)

Thaum koj khau raj cp/m 2.2 ntawm koj z80-mbc, tam sim no koj yuav tsum muaj z80asm.com thiab z80asm.doc (xaiv tau) ntawm tsav A

Kauj Ruam 2: Luam qhov Code Code rau Koj Z80-mbc2

Txuas mus rau z80-mbc siv koj lub davhlau ya nyob twg

Kuv qhia koj siv lub disk uas tsis muaj neeg sau los khaws cov cai hauv, piv txwv li f: xaiv hom tsav no:

F:

tom qab ob peb feeb koj yuav pom F: hais kom ua.

tam sim no siv zde16 program ntawm tsav A los kho cov ntaub ntawv tsis muaj dab tsi:

ib: zde16 myled.z80

Qhov no yuav tsim cov ntaub ntawv hu ua myled.z80 ntawm daim disk F:, nco ntsoov:.z80 xav tau hauv lub npe rau z80asm ua haujlwm.

Tam sim no theej thiab luam cov cai hauv qab no, nyob ntawm koj lub davhlau ya nyob twg nrawm thiab lwm yam koj yuav tsum tau luam thiab muab tso rau hauv ntu me. Los yog ntaus nws! tau txais qhov 1980's xav rov zoo ib yam.

;

Kuaj tus neeg siv LED thiab tus yuam sij siv; BDOS equ 05h; cp/m BDOS nkag nkag USRLED equ 0; opcode rau Cov Neeg Siv LED tswj USRKEY equ 80h; opcode rau Tus Neeg Siv Hloov tswj DPORT equ 0; DATA chaw nres nkoj i/o CPORT equ 1; Hais kom chaw nres nkoj tso tawm; org 00 00 Nws; ld (estack), sp; khaws cov ntaub ntawv tam sim no rau rov qab rau cp/m ld sp, pawg; ld hl, msg; nyob zoo hu xov tooj _puts lp: ld a, 1; tig rau = 1 hu coj coj hu qeeb; ncua thiab tos tus yuam sij (s) jr nz, ua tiav; tsis xoom txhais tau tias qhov tseem ceeb/hloov nias xor a; a = 0 hu coj hu qeeb; ncua lossis tos tus yuam sij/hloov jr z, lp; yog tias xoom, tsis muaj tus yuam sij/hloov, rov mus dua; ua tiav: xor a; qhov tseem ceeb lossis hloov pauv tau nias, yog li ua tiav hu coj ld hl, bye; hais bye hu _puts; tso saib msg HL = ld sp, (estack); thawj pawg rov qab; rov qab mus rau cp/m; coj: thawb af; txuag coj tus nqi 0 lossis 1 ld a, USRLED tawm (CPORT), a; optcode xa pop af out (DPORT), a; cov ntaub ntawv xa rov qab;; Ncua lub voj uas txheeb xyuas qhov tseem ceeb nias ntawm lub davhlau ya nyob twg lossis tus neeg siv lub sijhawm ncua: ld bc, 00e00h; kwv yees li 1/2s 8mhz CPU, kev kwv yees ua haujlwm ntxaws ntxaws2: dec bc; suav lub voj thawb bc; tseg regs thaum hu BDOS laub de ld c, 6; BDOS nyoos i/o kos yog qhov tseem ceeb nias ld e, 0ffh hu rau BDOS pop de; tau txais peb qhov txiaj ntsig rov qab los ntawm pawg pop bc lossis a; kos yog tias tus yuam sij nias ntawm lub davhlau ya nyob twg ret nz; yog rov qab (tseem khaws nz chij teeb) ld a, USRKEY; Tam sim no tshawb xyuas tus neeg siv qhov tseem ceeb tawm (CPORT), a; hais kom ua chaw nres nkoj hauv a, (DPORT); nyeem qhov tseem ceeb thiab a, 1; tsuas yog txaus siab rau me ntsis 0 ret nz; rov qab yog userkey nias ld a, b; lossis bc = 0 lossis c jr nz, loop2; tsis suav suav, rov mus dua xor a; teeb tsa tus ch chij rau 0 ret; rov qab tsis muaj tus yuam sij nias, kawg ncua; _puts: thawb bc; txuag peb cov kev npaj npaj rau bdos hu laub de nxt: ld a, (hl); tau txais char lossis a; kuaj yog tias nws yog 0, kawg ntawm msg jr z, ua tiav; yog li ua tiav ld e, a; teeb tsa hu mus rau BDOS los sau tus lej ld c, 2 thawb hl; txuag cov ntawv qhia pointer hu BDOS; luam nws pop hl inc hl; tom ntej char jr nxt; ua mus ntxiv: pop de; ua tiav rov regs pop bc ret; thiab rov qab; msg db 'Tus neeg siv LED kuaj, txhua tus yuam sij kom tawm' db 0ah, 0dh, 0 bye db 'Tawm' db 0ah, 0dh, 0 estack dw 0 ds 256 - 2 pawg: dw 0

Txuag cov ntaub ntawv siv ESC x. Saib ZDE16 siv phau ntawv qhia kom paub ntau ntxiv, nws yog me ntsis zoo li wordstar rau feem ntau kho, tshwj tsis yog Ctrl-K kev xaiv sib txawv.

Kauj Ruam 3: Txheeb thiab Ua Haujlwm Txoj Haujlwm

Thaum koj muaj koj qhov chaws nyob ntawm lub tshuab.

Hom:

F>

F> a: z80asm myled/a Z80ASM Copyright (C) 1983-86 los ntawm SLR Systems Rel. 1.32 MYLED/A End of file Pass 1 0 Error (s) Tshawb pom. 406 Tsis Pub Tshaj. 16 Cim Cim Pom.

Qhov no yuav nrhiav cov ntaub ntawv myled.z80 thiab tsim cov ntawv binary (.com), uas yog qhov kev xaiv /sawv rau.

Saib z80asm.doc cov ntaub ntawv kom paub ntau ntxiv.

Txhawm rau khiav qhov program, ntaus:

F> kuv

Tus neeg siv LED kuaj, ib qho tseem ceeb kom tawm F>

Nias tus neeg siv khawm lossis tus yuam sij ntawm lub dav hlau kom tawm mus.

Ua tiav

Pom zoo: