Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
48
Task/Integer-sequence/Z80-Assembly/integer-sequence-1.z80
Normal file
48
Task/Integer-sequence/Z80-Assembly/integer-sequence-1.z80
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
org &1000
|
||||
PrintChar equ &BB5A
|
||||
ld hl,1 ;START AT ONE
|
||||
main:
|
||||
push hl
|
||||
;PRINT HIGH BYTE
|
||||
ld a,h
|
||||
call ShowHex
|
||||
;THEN PRINT LOW BYTE
|
||||
ld a,l
|
||||
call ShowHex
|
||||
|
||||
;NEW LINE
|
||||
ld a,13
|
||||
call PrintChar
|
||||
ld a,10
|
||||
call PrintChar
|
||||
|
||||
pop hl
|
||||
;NEXT HL
|
||||
inc hl
|
||||
;COMPARE HL TO ZERO
|
||||
ld a,h
|
||||
or l
|
||||
jr nz,main ;IF NOT ZERO, REPEAT
|
||||
ret ;RETURN TO BASIC
|
||||
|
||||
|
||||
ShowHex:
|
||||
push af
|
||||
and %11110000
|
||||
rrca
|
||||
rrca
|
||||
rrca
|
||||
rrca
|
||||
call PrintHexChar
|
||||
pop af
|
||||
and %00001111
|
||||
;call PrintHexChar
|
||||
;execution flows into it naturally.
|
||||
PrintHexChar:
|
||||
;this converts hexadecimal to ascii.
|
||||
or a ;Clear Carry Flag
|
||||
daa
|
||||
add a,&F0
|
||||
adc a,&40
|
||||
jp PrintChar
|
||||
;ret
|
||||
88
Task/Integer-sequence/Z80-Assembly/integer-sequence-2.z80
Normal file
88
Task/Integer-sequence/Z80-Assembly/integer-sequence-2.z80
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
org &1000
|
||||
PrintChar equ &BB5A
|
||||
ld ix,NumberRam
|
||||
|
||||
main:
|
||||
|
||||
ld a,(ix+7)
|
||||
call ShowHex
|
||||
ld a,(ix+6)
|
||||
call ShowHex
|
||||
ld a,(ix+5)
|
||||
call ShowHex
|
||||
ld a,(ix+4)
|
||||
call ShowHex
|
||||
ld a,(ix+3)
|
||||
call ShowHex
|
||||
ld a,(ix+2)
|
||||
call ShowHex
|
||||
ld a,(ix+1)
|
||||
call ShowHex
|
||||
ld a,(ix+0)
|
||||
call ShowHex
|
||||
;NEW LINE
|
||||
ld a,13
|
||||
call PrintChar
|
||||
ld a,10
|
||||
call PrintChar
|
||||
|
||||
ld a,(ix+0)
|
||||
add 1 ;we can't just INC (ix+0) since that wouldn't affect the carry flag. So we have to add one to the value.
|
||||
ld (ix+0),a
|
||||
|
||||
ld a,(ix+1)
|
||||
adc 0 ;and carry it forward up to the max number of digits.
|
||||
ld (ix+1),a
|
||||
|
||||
ld a,(ix+2)
|
||||
adc 0
|
||||
ld (ix+2),a
|
||||
|
||||
ld a,(ix+3)
|
||||
adc 0
|
||||
ld (ix+3),a
|
||||
|
||||
ld a,(ix+4)
|
||||
adc 0
|
||||
ld (ix+4),a
|
||||
|
||||
ld a,(ix+5)
|
||||
adc 0
|
||||
ld (ix+5),a
|
||||
|
||||
ld a,(ix+6)
|
||||
adc 0
|
||||
ld (ix+6),a
|
||||
|
||||
ld a,(ix+7)
|
||||
adc 0
|
||||
ld (ix+7),a
|
||||
|
||||
jp main
|
||||
ret ;RETURN TO BASIC
|
||||
|
||||
|
||||
|
||||
ShowHex:
|
||||
push af
|
||||
and %11110000
|
||||
rrca
|
||||
rrca
|
||||
rrca
|
||||
rrca
|
||||
call PrintHexChar
|
||||
pop af
|
||||
and %00001111
|
||||
;call PrintHexChar
|
||||
;execution flows into it naturally.
|
||||
PrintHexChar:
|
||||
;this converts hexadecimal to ascii.
|
||||
or a ;Clear Carry Flag
|
||||
daa
|
||||
add a,&F0
|
||||
adc a,&40
|
||||
jp PrintChar
|
||||
;ret
|
||||
|
||||
NumberRam: ;a 64-bit value, stored little-endian
|
||||
db 01,00,00,00,00,00,00,00
|
||||
Loading…
Add table
Add a link
Reference in a new issue