
******* ASSEMBLE.800 assemblerar PROGKEY.ASM
******* till PAH-filen PROG1.PAH


----- PASS 1

BYTE_CNT 0000 0
HIGH_LOW 0002 2
MEM_LDIR 0004 4
MEMLDIR2 000B 11
NEWCONSI 001F 31
NEWCONS2 0020 32
NEWBUF   002E 46
EJMINUS  0037 55
BUFPOINT 0063 99
BUFFER   0065 101
ASMEND   0076 118


----- PASS 2

0000              ;Assemblerrutiner till programmet PROGKEY .800 av Peter "HPA" Anvin <4642>
0000              ;G|r varje tangentkod 0-127 samt 192-255 programmerbara med valfri l{ngd
0000              ;(max 16 tkn). Allt lagras i MEM: arean (802).
0000
0000                       ?ORG      ;Relokerbar kod!!!
0000  0000       BYTE_CNT: DEFW 0
0002  0000       HIGH_LOW: DEFW 0
0004  ED4B0000   MEM_LDIR: LD BC,(BYTE_CNT)
0008  2A0200               LD HL,(HIGH_LOW)
000B                                ;Ladda in MEM-minnet
000B  F3         MEMLDIR2: DI
000C  3E05                 LD A,5
000E  D323                 OUT (35),A
0010  3EE8                 LD A,0E8H
0012  D323                 OUT (35),A
0014  EDB0                 LDIR
0016  3E05                 LD A,5
0018  D323                 OUT (35),A
001A  AF                   XOR A
001B  D323                 OUT (35),A
001D  FB                   EI
001E  C9                   RET
001F                          ;Nya CONSI-rutinen
001F  E5         NEWCONSI: PUSH HL
0020  2A6300     NEWCONS2: LD HL,(BUFPOINT)
0023  7E                    LD A,(HL)
0024  FE83                 CP 83H
0026  2806                 JR Z,NEWBUF
0028  23                   INC HL
0029  226300               LD (BUFPOINT),HL
002C  E1                   POP HL
002D  C9                   RET
002E  CD0000     NEWBUF:   CALL 0   ;H{r ska adressen till gamla CONSI-rutinen ligga
0031  FEC0                 CP 192
0033  3802                 JR C,EJMINUS
0035  D640                 SUB 64
0037  6F         EJMINUS:  LD L,A
0038  2600                 LD H,0
003A  C5                   PUSH BC
003B  D5                   PUSH DE
003C  CB25                 SLA L
003E  CB14                 RL H
0040  CB25                 SLA L
0042  CB14                 RL H
0044  CB25                 SLA L
0046  CB14                 RL H
0048  CB25                 SLA L
004A  CB14                 RL H
004C  010074               LD BC,29696 ;Basadress
004F  09                   ADD HL,BC
0050  011000               LD BC,16
0053  116500               LD DE,BUFFER
0056  CD0B00               CALL MEMLDIR2
0059  D1                   POP DE
005A  C1                   POP BC
005B  216500               LD HL,BUFFER
005E  226300               LD (BUFPOINT),HL
0061  18BD                 JR NEWCONS2
0063  6500       BUFPOINT: DEFW BUFFER
0065  83         BUFFER:   DEFB 83H     ;Ladda buffer i b|rjan
0066                       DEFS 15
0075  83                   DEFB 83H     ;Om LEN=16 s} sluta h{r
0076             ASMEND:        ;H{r slutar det egentliga programmet
0076                         ;Definiera nya CONSI-rutinen
0076                       ORG 0FF90H
FF90  C31F00               JP NEWCONSI
FF93                       END


Assemblering avslutad
