-;--------------------------------------------------------------
-;
-; add a to hl
-;
-; return:
-; hl = hl + a
-; Flags undefined
-
- cseg ; (common. TODO: check for banked)
-
-add_hla:
- add a,l
- ld l,a
- ret nc
- inc h
- ret
-
-;----------------------------------------------------------------------
-
- ; output bytes to consecutive portaddresses
- ;
- ; hl: table with following structure:
- ; db n, port1, val1, val2,... valn
- ; db m, port1, val1, val2,... valm
- ; ...
- ; db 0 ; Terminate table
-
-
- cseg ; (common for now)
-
-ioiniml:
- push bc
- xor a
-ioml_lp:
- ld b,(hl)
- inc hl
- cp b
- jr z,ioml_e
-
- ld c,(hl)
- inc hl
- otimr
- jr ioml_lp
-ioml_e:
- pop bc
- ret
-
-;----------------------------------------------------------------------
-
- ; output bytes to ports
- ;
- ; hl: tables of port,value pairs:
- ; db n, port1,val1, port2,val2,... portn,valn
- ; ...
- ; db 0 ; Terminate table
-
- cseg ; (common for now)
-
-ioini1l:
- push bc
- jr io1_nxt
-io1_lp:
- ld c,(hl) ;port address
- inc hl
- otim
- jr nz,io1_lp
-io1_nxt:
- ld b,(hl) ;count
- inc hl
- inc b
- djnz io1_lp
-
- pop bc
- ret