User Tools

Site Tools


programmering:z80

Z80

Basic2Asm

Multiface Stuff

  • Genie
  • Lifeguard

GDB support

Sådan kan man få en gdb med Z80 support:

git clone https://github.com/legumbre/gdb-z80.git 
cd gdb-z80
./configure --enable-werror=no --target=z80-unknown-coff
make MAKEINFO=true
sudo make MAKEINFO=true install
ls /usr/local/bin/z80-unknown-coff-{gdb,gdbtui}
ddd --debugger z80-unknown-coff-gdb &

RND

; Generate a Random Number
; ------------------------
; The pseudo random number is generated by: (Last_Random_Number * $43) + $01FD
; Exit: HL=Random number ($0000-$FFFF).
;       A=Random number ($00-$FF, the low byte of HL).

L4098:  LD   A,(L4084)                          ; Fetch the last random number.
        LD   C,A

        LD   L,A
        LD   H,$00

; Generate HL=Last_Random_Number * $40

        LD   B,$06

L40A1:  ADD  HL,HL
        DJNZ L40A1

; Generate HL=Last_Random_Number * $43

        ADD  HL,BC
        ADD  HL,BC
        ADD  HL,BC

; Generate HL=(Last_Random_Number * $43) + $01FD

        LD   BC,$01FD
        ADD  HL,BC

        LD   A,L
        LD   (L4084),A                          ; Store the new random number.
        RET  
programmering/z80.txt · Last modified: 2020/08/21 12:23 by martin