Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Моргает светодиодами 6 раз
- ; 30 June 2024
- ;**************************** ******************
- .org 5h
- ld A, 7
- ld (0053h), A
- ld BC, (0053h)
- L_01:
- dec A
- OUT (C), A
- cp 0
- jp NZ, L_01
- ; Пример вызова функции, которая суммирует 2 аргумента
- ; 12 December 2023
- ;**************************** The main program.
- .org 4h
- LD H, 5
- LD L, 2
- LD SP, 00ffh
- push HL
- LD HL, 65535
- call foo
- xor A
- inc B
- dec c
- .end
- ;- - - - - - - - - - - - - - int add(int, int);
- .org 50h
- foo: pop DE
- pop BC
- LD A, C
- ADD A, B
- push DE
- ret
- .end
- ; Старая версия (устаревшая
- ;**************************** **************************** ****************************
- .org 4h
- LD C, 5
- LD B, 2
- LD SP, 0099h
- push BC
- LD BC, 0
- call L_2
- LD (00A7h), A
- LD bc,(00A7h)
- L_1: OUT (C), A
- inc A
- cp 33h ; = 51
- JP NZ, L_1
- LD A, C
- LD (0001h), A
- ;**************************** procedure
- .org 50h
- L_2: pop DE
- pop BC
- LD A, C
- ADD A, B
- push DE
- ret
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement