Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,71 @@
|
|||
func_fs:
|
||||
;input
|
||||
;hl = function to call
|
||||
;ix = data range to operate over
|
||||
;de = output area
|
||||
;b = length of data range
|
||||
|
||||
push bc
|
||||
ld (smc_fs+1),hl
|
||||
ld a,(ix+0)
|
||||
smc_fs:
|
||||
call 0 ;overwritten with the function address passed in HL
|
||||
|
||||
ld (de),a
|
||||
inc ix
|
||||
inc de
|
||||
pop bc
|
||||
djnz func_fs
|
||||
ret
|
||||
|
||||
f: ;dummy function - returns input as-is
|
||||
ret
|
||||
|
||||
f1:
|
||||
;returns A times 2
|
||||
sla a
|
||||
ret
|
||||
|
||||
f2:
|
||||
;returns A squared
|
||||
ld b,a
|
||||
jp square_small
|
||||
;ret
|
||||
|
||||
data1:
|
||||
db 0,1,2,3
|
||||
|
||||
data2
|
||||
db 2,4,6,8
|
||||
|
||||
output:
|
||||
ds 4
|
||||
|
||||
;these libraries allow us to write the output to the screen
|
||||
read "\SrcCPC\winape_monitor.asm"
|
||||
read "\SrcCPC\winape_stringop.asm"
|
||||
read "\SrcCPC\winape_showhex.asm"
|
||||
|
||||
square_small:
|
||||
;returns a*a into a
|
||||
LD C,B
|
||||
mul8_small:
|
||||
;multiplies two 8-bit regs, product is also 8 bit.
|
||||
;no overflow protection!
|
||||
;computes A = c * b
|
||||
ld a,c
|
||||
or a
|
||||
ret z
|
||||
|
||||
djnz skip_return_C
|
||||
;ADVANCED TRICKERY:
|
||||
; we need to decrement B anyway.
|
||||
; also if B = 1, then A = C.
|
||||
; C is already in A, which we need for the multiplication regardless.
|
||||
; This does the job for us in one instruction!
|
||||
; Most DJNZs are backward but this one is FORWARD!
|
||||
ret
|
||||
skip_return_C:
|
||||
add C
|
||||
djnz skip_return_C
|
||||
ret
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
;;;;;;;;;;;;;;;;;;; HEADER ;;;;;;;;;;;;;;;;;;;
|
||||
read "\SrcCPC\winape_macros.asm"
|
||||
read "\SrcCPC\MemoryMap.asm"
|
||||
read "\SrcALL\winapeBuildCompat.asm"
|
||||
;;;;;;;;;;;;;;;;;;; PROGRAM ;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
org &1000
|
||||
|
||||
ld hl,f1
|
||||
ld ix,data1
|
||||
ld de,output
|
||||
ld b,4
|
||||
call func_fs ;execute f1f(s) on data set 1
|
||||
|
||||
|
||||
call monitor_memdump ;display the output
|
||||
db 4
|
||||
dw output
|
||||
|
||||
call newline
|
||||
|
||||
ld hl,f1
|
||||
ld ix,data2
|
||||
ld de,output
|
||||
ld b,4
|
||||
call func_fs ;;execute f1f(s) on data set 2
|
||||
|
||||
|
||||
call monitor_memdump ;display the output
|
||||
db 4
|
||||
dw output
|
||||
|
||||
call newline
|
||||
|
||||
ld hl,f2
|
||||
ld ix,data1
|
||||
ld de,output
|
||||
ld b,4
|
||||
call func_fs
|
||||
|
||||
|
||||
call monitor_memdump
|
||||
db 4
|
||||
dw output
|
||||
|
||||
call newline
|
||||
|
||||
ld hl,f2
|
||||
ld ix,data2
|
||||
ld de,output
|
||||
ld b,4
|
||||
call func_fs
|
||||
|
||||
|
||||
call monitor_memdump
|
||||
db 4
|
||||
dw output
|
||||
|
||||
ret ;return to basic
|
||||
Loading…
Add table
Add a link
Reference in a new issue