home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128CPM / GRC128.ZIP / PXE3.MAC < prev    next >
Encoding:
Text File  |  1991-06-15  |  21.9 KB  |  1,575 lines

  1.  
  2.  
  3.  
  4.     .z80
  5.  
  6. external paddre
  7.  
  8. public olddma,scbpb,mode
  9.  
  10. public scradd
  11.  
  12. public lover,linv
  13.  
  14. public xinv,xover
  15.  
  16. public memstart,SWvxy,LWvxy,prep
  17.  
  18. public GrOn,GrOff
  19.  
  20. public sb1x1,sb1x2,sb1x3,sb1x4,sb1x5,sb1x6,sb1x7,sb1x8
  21.  
  22. external injn
  23.  
  24. public value,address,sadd,eadd
  25.  
  26. public GrSOn,GrFOn,GrFOff,SetDot,EraDot,ClrGr;entry points
  27.  
  28. public SetPix,EraPix;
  29.  
  30. public wert,myzl,ldv
  31.  
  32. public mfdm,ofdm,cfdm,SWFxy,LWFxy,pfrep;
  33.  
  34. public b1x8,sb1x8;
  35.  
  36. public flip,flop,skox,skoy,ekox,ekoy;
  37.  
  38. external texta,offsa;
  39.  
  40. public nextli,prbitm,crtab,prtab,convta,zeil0a;
  41.  
  42. public PFIlett;
  43.  
  44. public b12,b32,b33,b34,b35;
  45.  
  46. public mydma
  47.  
  48. ListOutPut equ 05h;
  49.  
  50. esc equ 1bh;
  51.  
  52.  
  53. GrOn:    call init        ;
  54.     push bc
  55.     push de
  56.     push hl
  57.     push ix
  58.     push iy
  59.     push af
  60.     ld (scradd),de
  61.     pop af
  62.     pop iy
  63.     pop ix
  64.     pop hl
  65.     pop de
  66.     pop bc
  67.     call charO        ;zeichen auslagern
  68.     call graclear        ;graphic mode on + clear
  69.     call clear        ;
  70.     call color        ;
  71.     jp  wiede        ;hole cpu-register
  72.  
  73.  
  74. GrOff:     call init        ;
  75.     push bc
  76.     push de
  77.     push hl
  78.     push ix
  79.     push iy
  80.     push af
  81.     ld (scradd),de
  82.     pop af
  83.     pop iy
  84.     pop ix
  85.     pop hl
  86.     pop de
  87.     pop bc
  88.     call clear        ;
  89.     call text        ;text mode on
  90.     call charI        ;characters einlesen
  91.     jp wiede        ;s.o
  92.  
  93.  
  94. PFIlett:    ld a,00d
  95.  
  96.     ld (b12),a
  97.  
  98.     ld (b32),a
  99.  
  100.     ld (b35),a
  101.  
  102.     call open
  103.  
  104.     ld a,00h
  105.  
  106.     ld (b33),a
  107.  
  108.     ld (b34),a
  109.  
  110.     ld de,fcb
  111.  
  112.     ld c,21h
  113.  
  114.     call bdos
  115.  
  116.     ld de,(offsa)    ;offsa -> de
  117.             ;offsa div 128 -> de
  118.     srl d
  119.     rr e        ;div 2
  120.     srl d
  121.     rr e        ;div 4
  122.  
  123.     srl d
  124.     rr e        ;div 8
  125.     srl d
  126.     rr e        ;div 16
  127.  
  128.     srl d
  129.     rr e        ;div 32
  130.     srl d
  131.     rr e        ;div 64
  132.  
  133.     srl d
  134.  
  135.     rr e        ;div 128d
  136.  
  137.     ld a,e        ;low-byte -> akku
  138.  
  139.     ld (b33),a    ;low-byte rec. no -> r0
  140.  
  141.     ld a,d        ;high byte -> akku
  142.  
  143.     ld (b34),a    ;high byte rec no -> r1
  144.  
  145.             ;r2 immer 0
  146.  
  147.     ld a,00h
  148.  
  149.         ld de,fcb    ;addr fcb -> de
  150.  
  151.     ld c,21h    ;bdos #33d
  152.  
  153.     call bdos    ;record in DMA buffer lesen
  154.  
  155.     ld de,(offsa)    ;offsa -> de
  156.  
  157.     ld d,00h    ;= mod 256d
  158.  
  159.     ld a,e        ;low byte = mod 256 -> akku
  160.  
  161.     and 01111111b    ;mod 128 -> akku
  162.  
  163.     ld e,a        ;zurueck in e
  164.  
  165.             ;de <- offsa mod 128
  166.  
  167.     ld hl,mydma    ;
  168.  
  169. ;    ld hl,128d    ;start DMA buffer
  170.  
  171.     add hl,de    ;start of char 
  172.  
  173.     ld (offsa),hl    ;offsa neu gesetzt
  174.  
  175.     call close     ;file schliessen
  176.  
  177.  
  178.             ld bc,0d600h        ;basis address of VDC
  179.         ld de,(offsa)        ;location in charrom
  180.         ld hl,(texta)        ;location on screen i.e. VDC
  181.         ld a,0h            ;schleienvar
  182.         ld (myzl),a        ;myzl = schleifenvar
  183.         jp testip        ;fertig ?
  184. againip:    ld a,h            ;update-address-high-byte
  185.         ld (wert),a        ;
  186.         ld a,18d        ;update-register high
  187.         call sldv        ;schreiben
  188.         ld a,l            ;update-address low-byte
  189.         ld (wert),a        ;
  190.         ld a,19d        ;update-register low
  191.         call sldv        ;schreiben
  192.         ld a,(de)        ;contents of sp.location in charrom
  193.  
  194.         push bc            ;bc retten
  195.         push de
  196.         ld d,a
  197.         ld bc,(injn)
  198.         ld a,c
  199.         cp 00h
  200.         jp z,weitjn
  201.         ld a,d
  202.         ld c,11111111b        ;invertmaske
  203.         xor c
  204.         ld d,a
  205. weitjn:        ld a,d
  206.         pop de
  207.         pop bc            ;bc holen
  208.     
  209.         ld (wert),a        ;
  210.         ld a,31d        ;data-register
  211.         call sldv        ;
  212.         inc de            ;next byte of char. bit-map
  213.         ld bc,80d        ;offset to next line
  214.         add hl,bc        ;next screenlocation in hl
  215.         ld bc,0d600h        ;correct bc
  216.         ld a,(myzl)        ;schleifenvar
  217.         inc a            ;schleifenvar+1 !!!!!!!
  218.         ld (myzl),a        ;und speichern !!!!!!!!
  219. testip:        cp 08d            ;ready ?
  220.         jp m,againip        ;
  221.         ret        ;chiao
  222.  
  223.  
  224. zeil0a:        ld e,esc
  225.         ld c,ListOutPut
  226.         call bdos
  227.         ld e,"3"
  228.         ld c,ListOutPut
  229.         call bdos
  230.         ld e,21d
  231.         ld c,ListoutPut
  232.         call bdos
  233.         ret
  234.  
  235. mode:        ds 1,00h
  236.  
  237. prbitm:        ld e,esc
  238.         ld c,ListOutPut
  239.         call bdos;
  240.         ld e,2ah
  241.         ld c,ListOutput
  242.         call bdos
  243.         ld a,(mode)
  244.         ld e,a
  245.         ld c,ListOutPut
  246.         call bdos;
  247.         ld e,128d
  248.         ld c,ListOutPut
  249.         call bdos
  250.         ld e,02d
  251.         ld c,ListOutPut
  252.         call bdos
  253.         ret
  254.  
  255. nextli:        ld e,13d
  256.         ld c,ListOutPut
  257.         call bdos
  258.         ld e,10d
  259.         ld c,ListOutPut
  260.         call bdos
  261.         ret
  262.  
  263. crtab:        ld bc,0d600h
  264.         ld hl,(paddre)
  265.         ld ix,tab
  266.         ld de,80d
  267.         ld a,0h
  268.         ld (zaehlerpx),a
  269.         jp testpx
  270. againpx:    ld a,h
  271.         ld (wert),a
  272.         ld a,18d
  273.         call sldv
  274.         ld a,l
  275.         ld (wert),a
  276.         ld a,19d
  277.         call sldv
  278.         ld a,31d
  279.         call rdv
  280.         ld (ix),a
  281.         inc ix
  282.         add hl,de
  283.         ld a,(zaehlerpx)
  284.         inc a
  285.         ld (zaehlerpx),a
  286. testpx:        cp 08d
  287.         jp m,againpx
  288.         ret
  289.  
  290. prtab:        ld bc,tabl
  291.         ld (aktzeiger),bc
  292.         ld a,0h
  293.         ld (aktschleife),a
  294.         jp testqx
  295. againqx:    ld bc,(aktzeiger)
  296.         ld a,(bc)
  297.         ld e,a
  298.         ld c,ListOutPut
  299.         call bdos
  300.         ld bc,(aktzeiger)
  301.         inc bc
  302.         ld (aktzeiger),bc
  303.         ld a,(aktschleife)
  304.         inc a
  305.         ld (aktschleife),a
  306. testqx:        cp 08d
  307.         jp m,againqx
  308.         ret
  309.  
  310. convta:        ld ix,tabl
  311.         ld b,0h
  312.         jp testpz
  313. againpz:    ld hl,0000h
  314.         ld de,tab
  315.         ld c,0h
  316.         jp testpy
  317. againpy:    ld a,(de)
  318.         ld l,a
  319.         call schiebe
  320.         sla l
  321.         rl h
  322.         inc c
  323.         inc de
  324. testpy:        ld a,c
  325.         cp 08d
  326.         jp m,againpy
  327.         ld (ix),h
  328.         inc b
  329.         inc ix
  330. testpz:        ld a,b
  331.         cp 08d
  332.         jp m,againpz
  333.         ret
  334.  
  335. schiebe:    ld a,b
  336.         ld (spsave),a
  337.         jp testpr
  338. againpr:    sla l
  339.         dec b
  340. testpr:        ld a,b
  341.         cp 0h
  342.         jp nz,againpr
  343.         ld a,(spsave)
  344.         ld b,a
  345.         ret
  346.         
  347. SetPix:
  348.     ld (rbc),bc
  349.     ld (rhl),hl
  350.     pop hl
  351.     ld (sxret),hl
  352.     ld l,e
  353.     ld h,d
  354.     ld c,(hl)
  355.     inc hl
  356.     ld b,(hl)
  357.     ld (flip),bc
  358.     inc hl
  359.     ld c,(hl)
  360.     inc hl
  361.     ld b,(hl)
  362.     ld (flop),bc
  363.     ld bc,(rbc)
  364.     ld hl,(rhl)
  365.  
  366.     push bc
  367.     push de
  368.     push hl
  369.     push ix
  370.     push iy
  371.     push af
  372.     call SetDot
  373.     pop af
  374.     pop iy
  375.     pop ix
  376.     pop hl
  377.     pop de
  378.     pop bc
  379.     ld (rhl),hl
  380.     ld hl,(sxret)
  381.     push hl
  382.     ld hl,(rhl)
  383.     ret
  384.      
  385.  
  386. ;    pop hl            ;returnaddr.
  387. ;    pop de            ;y-Koordin.
  388. ;    pop bc            ;x-Koordin.
  389. ;    ld (flop),de        ;
  390. ;    ld (flip),bc        ;
  391. ;    push hl            ;returnaddr.
  392. ;    call SetDot        ;
  393. ;    ret            ;
  394. ;
  395. ;
  396.  
  397.  
  398. EraPix:
  399.     ld (rbc),bc
  400.     ld (rhl),hl
  401.     pop hl
  402.     ld (sxret),hl
  403.     ld l,e
  404.     ld h,d
  405.     ld c,(hl)
  406.     inc hl
  407.     ld b,(hl)
  408.     ld (flip),bc
  409.     inc hl
  410.     ld c,(hl)
  411.     inc hl
  412.     ld b,(hl)
  413.     ld (flop),bc
  414.     ld bc,(rbc)
  415.     ld hl,(rhl)
  416.  
  417.     push bc
  418.     push de
  419.     push hl
  420.     push ix
  421.     push iy
  422.     push af
  423.     call EraDot
  424.     pop af
  425.     pop iy
  426.     pop ix
  427.     pop hl
  428.     pop de
  429.     pop bc
  430.     ld (rhl),hl
  431.     ld hl,(sxret)
  432.     push hl
  433.     ld hl,(rhl)         
  434.     ret
  435.  
  436.  
  437. ;    pop hl            ;returnaddr.
  438. ;    pop de            ;y-Koordin.
  439. ;    pop bc            ;x-Koordin.
  440. ;    ld (flop),de        ;
  441. ;    ld (flip),bc        ;
  442. ;    push hl            ;returnaddr.
  443. ;    call EraDot        ;
  444. ;    ret            ;
  445.  
  446.  
  447.  
  448.  
  449. init:    di            ;no interrupts
  450.     ld (memory),hl        ;register in speicher
  451.     pop hl            ;hole ruecksprungaddresse
  452.     ld (ret),hl        ;ruecksprungaddresse in speicher
  453.     ld hl,(memory)        ;alter wert hl in register
  454.         push bc         ;rette cpu-register
  455.     push de            ;
  456.     push hl            ;
  457.     push ix            ;
  458.     push iy            ;
  459.     push af            ;
  460.     ld bc,(ret)        ;ruecksprungaddr auf top von stapel
  461.     push bc            ;
  462.     ret            ;zurueck
  463.  
  464. GrSOn:  call init        ;
  465.     call graclear        ;
  466.     call clear        ;
  467.     call color        ;
  468.     jp wiede        ;
  469.  
  470.  
  471.  
  472. GrFOn:    call init        ;
  473.     push bc
  474.     push de
  475.     push hl
  476.     push ix
  477.     push iy
  478.     push af
  479.     ld de,scbpb
  480.     ld c,49d
  481.     call bdos
  482.     ld (olddma),hl
  483.     ld de,mydma
  484.     ld c,26d
  485.     call bdos
  486.     pop af
  487.     pop iy
  488.     pop ix
  489.     pop hl
  490.     pop de
  491.     pop bc    
  492.     call charFO        ;zeichen auslagern
  493.     call graclear        ;graphic mode on + clear
  494.     call clear        ;
  495.     call color        ;
  496.     push bc
  497.     push de
  498.     push hl
  499.     push ix
  500.     push iy
  501.     push af
  502.     ld de,(olddma)
  503.     ld c,26d
  504.     call bdos
  505.     pop af
  506.     pop iy
  507.     pop ix
  508.     pop hl
  509.     pop de
  510.     pop bc
  511.     jp  wiede        ;hole cpu-register
  512.  
  513. GrFOff:  call init        ;
  514.     push bc
  515.     push de
  516.     push hl
  517.     push ix
  518.     push iy
  519.     push af
  520.     ld de,scbpb
  521.     ld c,49d
  522.     call bdos
  523.     ld (olddma),hl
  524.     ld de,mydma
  525.     ld c,26d
  526.     call bdos
  527.     pop af
  528.     pop iy
  529.     pop ix
  530.     pop hl
  531.     pop de
  532.     pop bc    
  533.     call clear        ;
  534.     call text        ;text mode on
  535.     call charFI        ;characters einlesen
  536.         push bc
  537.     push de
  538.     push hl
  539.     push ix
  540.     push iy
  541.     push af
  542.     ld de,(olddma)
  543.     ld c,26d
  544.     call bdos
  545.     pop af
  546.     pop iy
  547.     pop ix
  548.     pop hl
  549.     pop de
  550.     pop bc
  551.     jp wiede        ;s.o
  552.  
  553.  
  554. SetDot:    call init        ;
  555.     call trxy        ;transformer programm
  556.     call setpoint        ;
  557.     jp wiede        ;s.o.
  558.  
  559.  
  560. EraDot:    call init        ;
  561.     call trxy        ;
  562.     call erapoint        ;
  563.     jp wiede        ;
  564.  
  565.  
  566. ClrGr:    call init        ;
  567.     call clear        ;
  568.     jp  wiede        ;
  569.  
  570.  
  571.  
  572. pfrep:    call init
  573.     ld bc,mydma        ;
  574. ;    ld bc,128d        ;
  575.     ld (afpos),bc        ;
  576.     ld a,00            ;
  577.     ld (zaehler),a        ;
  578.     jp wiede        ;
  579.  
  580.  
  581. SWFxy:    call init        ;
  582.     call trxy        ;
  583.     call ulk        ;
  584.     jp wiede        ;
  585.  
  586. LWFxy:    call init        ;
  587.     call trxy        ;
  588.     call luz        ;
  589.     jp wiede        ;
  590.  
  591.  
  592. dmacl:    push bc        ;
  593.     push de        ;
  594.     push hl        ;
  595.     push iy        ;
  596.     push ix        ;
  597.     ld b,00        ;
  598.     ld iy,mydma
  599. ;    ld iy,128d    ;
  600.     jp testk    ;
  601. againk:    ld a,00        ;
  602.     ld (iy),a    ;
  603.     inc b        ;
  604.     inc iy        ;
  605. testk:    ld a,b        ;
  606.     cp 128d        ;
  607.     jp nz,againk    ;
  608.     pop ix        ;
  609.     pop iy        ;
  610.     pop hl        ;
  611.     pop de        ;
  612.     pop bc        ;
  613.     ret        ;
  614.  
  615. wiede:    pop af        ;hole cpu register von stapel
  616.     pop iy        ;
  617.     pop ix        ;
  618.     pop hl        ;
  619.     pop de        ;
  620.     pop bc        ;
  621.     ei        ;interrupts wieder zugelassen
  622.     ret        ;ruecksprung in hauptprogramm
  623.  
  624.     bdos equ 0005h    ;
  625.  
  626. make:    push bc        ;
  627.     push de        ;
  628.     push hl        ;
  629.     push iy        ;
  630.     push ix        ;
  631.     ld c,16h    ;
  632.     ld de,fcb    ;
  633.     call bdos    ;
  634.     pop ix        ;
  635.     pop iy        ;
  636.     pop hl        ;
  637.     pop de        ;
  638.     pop bc        ;
  639.     ret        ;
  640.  
  641.  
  642. make1:    push bc        ;
  643.     push de        ;
  644.     push hl        ;
  645.     push iy        ;
  646.     push ix        ;
  647.     ld c,16h    ;
  648.     ld de,fcb1    ;
  649.     call bdos    ;
  650.     pop ix        ;
  651.     pop iy        ;
  652.     pop hl        ;
  653.     pop de        ;
  654.     pop bc        ;
  655.     ret        ;
  656.  
  657. mfdm:    call init    ;
  658.     call make1    ;
  659.     ld a,00        ;
  660.     ld (sb12),a    ;
  661.     ld (sb32),a    ;
  662.     call dmacl    ;
  663.     jp wiede    ;
  664.  
  665.  
  666. close:    push bc        ;
  667.     push de        ;
  668.     push hl        ;
  669.     push iy        ;
  670.     push ix        ;
  671.     ld c,10h    ;
  672.     ld de,fcb    ;
  673.     call bdos    ;
  674.     pop ix        ;
  675.     pop iy        ;
  676.     pop hl        ;
  677.     pop de        ;
  678.     pop bc        ;
  679.     ret        ;
  680.  
  681.  
  682. close1:    push bc        ;
  683.     push de        ;
  684.     push hl        ;
  685.     push iy        ;
  686.     push ix        ;
  687.     ld c,10h    ;
  688.     ld de,fcb1    ;
  689.     call bdos    ;
  690.     pop ix        ;
  691.     pop iy        ;
  692.     pop hl        ;
  693.     pop de        ;
  694.     pop bc        ;
  695.     ret        ;
  696.  
  697. cfdm:    call init    ;
  698.     call wr1    ;
  699.     call close1    ;
  700.     jp wiede    ;
  701.  
  702. wr:    push bc        ;
  703.     push de        ;
  704.     push hl        ;
  705.     push iy        ;
  706.     push ix        ;
  707.     ld c,15h    ;
  708.     ld de,fcb    ;
  709.     call bdos    ;
  710.     pop ix        ;
  711.     pop iy        ;
  712.     pop hl        ;
  713.     pop de        ;
  714.     pop bc        ;
  715.     ret        ;
  716.  
  717.  
  718. wr1:    push bc        ;
  719.     push de        ;
  720.     push hl        ;
  721.     push iy        ;
  722.     push ix        ;
  723.     ld c,15h    ;
  724.     ld de,fcb1    ;
  725.     call bdos    ;
  726.     pop ix        ;
  727.     pop iy        ;
  728.     pop hl        ;
  729.     pop de        ;
  730.     pop bc        ;
  731.     ret        ;
  732.  
  733.  
  734.  
  735. rdx:    push bc        ;
  736.     push de        ;
  737.     push hl        ;
  738.     push iy        ;
  739.     push ix        ;
  740.     ld c,14h    ;
  741.     ld de,fcb    ;
  742.     call bdos    ;
  743.     pop ix        ;
  744.     pop iy        ;
  745.     pop hl        ;
  746.     pop de        ;
  747.     pop bc        ;
  748.     ret        ;
  749.  
  750. rdx1:    push bc        ;
  751.     push de        ;
  752.     push hl        ;
  753.     push iy        ;
  754.     push ix        ;
  755.     ld c,14h    ;
  756.     ld de,fcb1    ;
  757.     call bdos    ;
  758.     pop ix        ;
  759.     pop iy        ;
  760.     pop hl        ;
  761.     pop de        ;
  762.     pop bc        ;
  763.     ret        ;
  764.  
  765.  
  766. open:    push bc        ;
  767.     push de        ;
  768.     push hl        ;
  769.     push iy        ;
  770.     push ix        ;
  771.     ld c,0fh    ;
  772.     ld de,fcb    ;
  773.     call bdos    ;
  774.     pop ix        ;
  775.     pop iy        ;
  776.     pop hl        ;
  777.     pop de        ;
  778.     pop bc        ;
  779.     ret        ;
  780.  
  781.  
  782.  
  783. open1:    push bc        ;
  784.     push de        ;
  785.     push hl        ;
  786.     push iy        ;
  787.     push ix        ;
  788.     ld c,0fh    ;
  789.     ld de,fcb1    ;
  790.     call bdos    ;
  791.     pop ix        ;
  792.     pop iy        ;
  793.     pop hl        ;
  794.     pop de        ;
  795.     pop bc        ;
  796.     ret        ;
  797.  
  798. ofdm:    call init    ;
  799.     call open1    ;
  800.     ld a,00        ;
  801.     ld (sb12),a    ;
  802.     ld (sb32),a    ;
  803.     call rdx1    ;
  804.     jp wiede    ;
  805.  
  806.  
  807. ldv:    out (c),a    ;
  808.     call schl1    ;
  809.     inc bc        ;
  810.     ld a,(wert)    ;
  811.     out (c),a    ;
  812.     call schl1    ;
  813.     dec bc        ;
  814.     ret        ;
  815.  
  816.  
  817. sldv:    out (c),a    ;
  818.     nop
  819.     nop
  820.     nop
  821.     nop    ;
  822.     inc bc        ;
  823.     ld a,(wert)    ;
  824.     out (c),a    ;
  825.     nop
  826.     nop
  827.     nop
  828.     nop
  829.     dec bc        ;
  830.     ret        ;
  831.  
  832.  
  833. ldv1:    out (c),a    ;
  834.     call schl2    ;
  835.     inc bc        ;
  836.     ld a,(wert)    ;
  837.     out (c),a    ;
  838.     call schl2    ;
  839.     dec bc        ;
  840.     ret        ;
  841.  
  842.  
  843.  
  844. sldv1:    out (c),a    ;
  845.     nop
  846.     nop
  847.     nop
  848.     nop
  849.     inc bc        ;
  850.     ld a,(wert)    ;
  851.     out (c),a    ;
  852.     nop
  853.     nop
  854.     nop
  855.     nop
  856.     dec bc        ;
  857.     ret        ;
  858.  
  859. rdv:    out (c),a    ;
  860.     call schl1    ;
  861.     inc bc        ;
  862.     in a,(c)    ;
  863.     dec bc        ;
  864.     ret        ;
  865.  
  866.  
  867. srdv:    out (c),a    ;
  868.     nop
  869.     nop
  870.     nop
  871.     nop
  872.     inc bc        ;
  873.     in a,(c)    ;
  874.     dec bc        ;
  875.     ret        ;
  876.  
  877.  
  878.  schl1:    ld a,20d    ;
  879.  wait1:    dec a        ;
  880.     jp nz,wait1    ;
  881.     ret        ;
  882.  
  883.  
  884.  schl3:    ld a,1d    ;
  885.  wait3:    dec a        ;
  886.     jp nz,wait3    ;
  887.     ret        ;
  888.  
  889.  
  890.  schl2:    ld a,55d    ;
  891.  wait2:    dec a        ;
  892.     jp nz,wait2    ;
  893.     ret        ;
  894.     
  895.  
  896.  schl4:    ld a,1d    ;
  897.  wait4:    dec a        ;
  898.     jp nz,wait4    ;
  899.     ret        ;
  900.  
  901. charFO: call make        ;make file
  902.     ld a,00d        ;
  903.     ld (b12),a        ;ex null setzen
  904.     ld (b32),a        ;byte 32 null
  905.     ld (zaehler),a        ;zaehler initialisieren
  906.     ld de,2000h        ;start address of VDC-char-ram
  907.     ld hl,8192d        ;zaehler
  908.     ld iy,mydma    
  909. ;    ld iy,128d        ;array-start-address
  910.     ld bc,0d600h        ;start of VDC-chip
  911.     
  912.     
  913.         jp test3        ;fertig? <while schleife>
  914.  
  915. again3:    ld a,d            ;update-high-register
  916.     ld (wert),a        ;
  917.     ld a,18d        ;
  918.     call ldv        ;  +-+-^
  919.     ld a,e            ;
  920.     ld (wert),a        ;
  921.     ld a,19d        ;
  922.     call ldv        ;  +-+-^
  923.     ld a,31d        ;
  924.     call rdv        ;
  925.     ld (iy),a        ;
  926.     ld a,(zaehler)        ;
  927.     cp 127d            ;
  928.     jp nz,nob        ;
  929.     call wr            ;
  930.     ld a,00d        ;
  931.     ld iy,mydma-1
  932. ;    ld iy,127d        ;
  933.     jp goon            ;
  934. nob:    inc a            ;
  935. goon:    ld (zaehler),a        ;
  936.     inc de            ;next address in char-ram of VDC
  937.     inc iy            ;next address in array charrom
  938.     dec hl            ;zaehler-1
  939. test3:    ld a,00            ;
  940.     cp h            ;h=0?
  941.     jp nz,again3        ;!=0 nicht fertig -> weiter
  942.     cp l            ;h=0 and l=0 ?
  943.     jp nz,again3        ;nein -> noch eine schleife
  944.     call close        ;
  945.     ret            ;zurueck zu charO charI
  946.  
  947.  
  948.  
  949.  
  950.  
  951. charFI:    call open        ;
  952.     ld a,00d        ;
  953.     ld (b12),a        ;ex auf null stzen
  954.     ld (b32),a        ;cr auf null to read file from rec.0 
  955.     ld (zaehler),a        ;zaehler initialisieren
  956.     ld de,2000h        ;start address of VDC-char-ram
  957.     ld hl,8192d        ;zaehler
  958.     ld iy,mydma
  959. ;    ld iy,128d        ;array-start-address
  960.     ld bc,0d600h        ;start of VDC-chip
  961.     
  962.     call rdx        ;
  963.     jp test4        ;fertig? <while schleife>
  964. again4:    ld a,d            ;update-high-register
  965.     ld (wert),a        ;
  966.     ld a,18d        ;
  967.     call ldv        ;  +-+-^
  968.     ld a,e            ;
  969.     ld (wert),a        ;
  970.     ld a,19d        ;
  971.     call ldv        ; +-+-^
  972.     ld a,(iy)        ;
  973.     ld (wert),a        ;
  974.     ld a,31d        ;
  975.     call ldv        ; +-+-^
  976.     ld a,(zaehler)        ;
  977.     cp 127d            ;
  978.     jp nz,nob1        ;
  979.     call rdx        ;
  980.     ld iy,mydma-1        ;
  981. ;    ld iy,127d        ;
  982.     ld a,00d        ;
  983.     jp goon1        ;
  984. nob1:    inc a            ;
  985. goon1:    ld (zaehler),a        ;
  986.     inc de            ;next address in char-ram of VDC
  987.     inc iy            ;next address in array charrom
  988.     dec hl            ;zaehler-1
  989. test4:    ld a,00            ;
  990.     cp h            ;h=0?
  991.     jp nz,again4        ;!=0 nicht fertig -> weiter
  992.     cp l            ;h=0 and l=0 ?
  993.     jp nz,again4        ;nein -> noch eine schleife
  994.     call close        ;
  995.     ret            ;                    
  996.  
  997.  
  998. graclear:  ld bc,0d600h        ;start address of VDC
  999.     
  1000.     ld a,25d        ;
  1001.     call rdv        ;
  1002.     ld (reg25),a        ;
  1003.     and 0fh            ;unteren 4 bits
  1004.     or 128d            ;
  1005.     ld (wert),a        ;
  1006.     ld a,25d        ;graphic modus on
  1007.     call ldv1        ; +-+-^
  1008.     ret            ;
  1009.  
  1010.  
  1011. clear:    ld bc,0d600h        ;
  1012.     ld a,64d        ;
  1013.     ld e,a            ;
  1014. again9:    ld a,e            ;
  1015.     ld (wert),a        ;
  1016.     ld a,18d        ;
  1017.     call ldv1        ; +-+-^
  1018.     ld a,00            ;
  1019.     ld (wert),a        ;
  1020.     ld a,31d        ;
  1021.     call ldv1        ;  +-+-^
  1022.     ld a,30d        ;
  1023.     call ldv1        ;  +-+-^
  1024.     dec e            ;
  1025.     jp p,again9        ;
  1026.     ret            ;
  1027.  
  1028.  
  1029. text:    ld bc,0d600h    ;start VDC-chip
  1030.     ld a,(save)    ;
  1031.     ld (wert),a    ;
  1032.     ld a,26d    ;
  1033.     call ldv    ; +-+-^
  1034.     ld a,(reg25)    ;
  1035.     ld (wert),a    ;
  1036.     ld a,25d    ;
  1037.     call ldv1    ;  +-+-^
  1038.     ret        ;
  1039.  
  1040.  
  1041.  
  1042.  setpoint:     ld bc,0d600h        ;start of VDC-chip in RAM
  1043.     
  1044.  
  1045.     ld a,(address+1)    ;
  1046.     ld (wert),a        ;
  1047.     ld a,18d        ;update-high-register
  1048.     call sldv        ;
  1049.     ld a,(address)        ;
  1050.     ld (wert),a        ;
  1051.     ld a,19d        ;
  1052.     call sldv        ;
  1053.     ld a,31d        ;
  1054.     call srdv        ;
  1055.     ld d,a            ;
  1056.     ld a,(value)        ;
  1057.     or d            ;
  1058.     ld d,a            ;
  1059.     ld a,(address+1)    ;
  1060.     ld (wert),a        ;
  1061.     ld a,18d        ;
  1062.     call sldv        ;
  1063.     ld a,(address)        ;
  1064.     ld (wert),a        ;
  1065.     ld a,19d        ;
  1066.     call sldv        ;
  1067.     ld a,d            ;
  1068.     ld (wert),a        ;
  1069.     ld a,31d        ;
  1070.     call sldv        ;
  1071.     ld a,18d        ;
  1072.     call srdv        ;
  1073.     ret            ;
  1074.  
  1075.  
  1076.  
  1077.  
  1078. erapoint:     ld bc,0d600h        ;start of VDC-chip in RAM
  1079.     
  1080.  
  1081.     ld a,(address+1)    ;
  1082.     ld (wert),a        ;
  1083.     ld a,18d        ;update-high-register
  1084.     call sldv        ;
  1085.     ld a,(address)        ;
  1086.     ld (wert),a        ;
  1087.     ld a,19d        ;
  1088.     call sldv        ;
  1089.     ld a,31d        ;
  1090.     call srdv        ;
  1091.     ld d,a            ;
  1092.     ld a,(value)        ;
  1093.     xor 0ffh        ;            
  1094.     and d            ;
  1095.     ld d,a            ;
  1096.     ld a,(address+1)    ;
  1097.     ld (wert),a        ;
  1098.     ld a,18d        ;
  1099.     call sldv        ;
  1100.     ld a,(address)        ;
  1101.     ld (wert),a        ;
  1102.     ld a,19d        ;
  1103.     call sldv        ;
  1104.     ld a,d            ;
  1105.     ld (wert),a        ;
  1106.     ld a,31d        ;
  1107.     call sldv        ;
  1108.     ld a,18d        ;
  1109.     call srdv        ;
  1110.     ret            ;
  1111.  
  1112.  
  1113.  
  1114.  
  1115.     
  1116.  
  1117.  
  1118. color:    ld bc,0d600h        ;     
  1119.     ld a,26d        ;
  1120.     call rdv        ;
  1121.     ld (save),a        ;
  1122.     ld a,240d        ;
  1123.     ld (wert),a        ;
  1124.     ld a,26d        ;
  1125.     call ldv        ; +-+-^
  1126.     ret            ;
  1127.  
  1128.  
  1129.  
  1130.  
  1131. ulk:    ld bc,0d600h        ;
  1132.     ld iy,(afpos)        ;
  1133.     ld a,(address+1)    ;
  1134.     ld (wert),a        ;
  1135.     ld a,18d        ;
  1136.     call sldv1        ;
  1137.     ld a,(address)        ;
  1138.     ld (wert),a        ;
  1139.     ld a,19d        ;
  1140.     call sldv1        ;
  1141.     ld a,31d        ;
  1142.     call srdv        ;
  1143.     ld (iy),a        ;
  1144.     ld a,(zaehler)        ;
  1145.     cp 127d            ;
  1146.     jp nz,nob9        ;
  1147.     call wr1        ;
  1148.     ld a,00            ;
  1149.     ld iy,mydma-1
  1150. ;    ld iy,127        ;
  1151.     jp goon9        ;
  1152. nob9:    inc a            ;
  1153. goon9:    ld (zaehler),a        ;
  1154.     inc iy            ;
  1155.     ld (afpos),iy        ;
  1156.     ret            ;
  1157.  
  1158.  
  1159. luz:    ld bc,0d600h        ;
  1160.     ld iy,(afpos)        ;
  1161.     ld a,(address+1)    ;
  1162.     ld (wert),a        ;
  1163.     ld a,18d        ;
  1164.     call sldv1        ;
  1165.     ld a,(address)        ;
  1166.     ld (wert),a        ;
  1167.     ld a,19d        ;
  1168.     call sldv1        ;
  1169.     ld a,(iy)        ;
  1170.     ld (wert),a        ;
  1171.  
  1172.     ld a,(linv)
  1173.     cp 00h
  1174.     jr z,noinv
  1175.     push bc
  1176.     ld c,11111111b
  1177.     ld a,(wert)
  1178.     xor c
  1179.     ld (wert),a
  1180.     pop bc
  1181. noinv:  ld a,(lover)
  1182.     cp 00h
  1183.     jr z,dover
  1184.     push de
  1185.     ld a,31d
  1186.     call srdv
  1187.     ld e,a
  1188.     ld a,(wert)
  1189.     or e
  1190.     ld (spvalue),a
  1191.     ld a,(address+1)
  1192.     ld (wert),a
  1193.     ld a,18d
  1194.     call sldv1
  1195.     ld a,(address)
  1196.     ld (wert),a
  1197.     ld a,19d
  1198.     call sldv1
  1199.     ld a,(spvalue)
  1200.     ld (wert),a
  1201.     pop de
  1202.     
  1203. dover:    ld a,31d
  1204.     
  1205.     call sldv1        ;
  1206.     ld a,(zaehler)        ;
  1207.     cp 127d            ;
  1208.     jp nz,nob8        ;
  1209.     call rdx1        ;
  1210.     ld a,00            ;
  1211.     ld iy,mydma-1
  1212. ;    ld iy,127        ;
  1213.     jp goon8        ;
  1214. nob8:    inc a            ;
  1215. goon8:    ld (zaehler),a        ;
  1216.     inc iy            ;
  1217.     ld (afpos),iy        ;
  1218.     ret            ;
  1219.  
  1220.  
  1221.  
  1222.  
  1223. div8:    pop de            ;Ruechsprungaddr.
  1224.     pop bc            ;flip --> bc
  1225.     srl b            ;
  1226.     rr c            ;div 2
  1227.     srl b
  1228.     rr c            ;div 2
  1229.     srl b
  1230.     rr c            ;3*(div 2) --> div 8
  1231.     push bc            ;rg. --> stack
  1232.     push de            ;Ruecksprungaddr.--> stack
  1233.     ret            ;chiao
  1234.  
  1235.  
  1236. iadd:    pop de            ;Ruecksprungaddr
  1237.     pop bc            ;summ1
  1238.     pop hl            ;summ2
  1239.     add hl,bc        ;(sum1 + sum2) --> hl
  1240.     push hl            ;erg. --> stack
  1241.     push de            ;
  1242.     ret            ;chiao
  1243.  
  1244.  
  1245. imul:    pop ix            ;Ruecksprungaddr.
  1246.     pop bc            ;Multiplikator
  1247.     ld b,08h        ;
  1248.     pop de            ;Multiplikand
  1249.     ld d,00h        ;
  1250.     ld hl,00h        ;
  1251. mul:    srl c            ;LSB = 1 ?
  1252.     jr nc,noadd        ;= 0 kein add
  1253.     add hl,de        ;
  1254. noadd:    sla e            ;e * 2
  1255.     rl d            ;carry --> LSB d
  1256.     dec b            ;schon 8x ?
  1257.     jp nz,mul        ;nein --> nochmal
  1258.     push hl            ;erg.
  1259.     push ix            ;Ruecksprungaddr.
  1260.     ret            ;
  1261.  
  1262.  
  1263. prep:    call init        ;
  1264.     ld bc,(memstart)        ;
  1265.     ld (apos),bc        ;
  1266.     jp wiede        ;
  1267.  
  1268.  
  1269. SWvxy:    call init        ;
  1270.     call trxy        ;
  1271.     call mnop        ;
  1272.     jp wiede        ;    
  1273.  
  1274.  
  1275. LWvxy:    call init        ;
  1276.     call trxy        ;
  1277.     call lku        ;
  1278.     jp wiede        ;    
  1279.  
  1280.  
  1281.     
  1282. trxy:    ld bc,(flip)        ;
  1283.     push bc            ;flip --> stapel
  1284.     call div8        ;(flip div 8) --> stapel
  1285.     ld bc,(flop)        ;
  1286.     push bc            ;flop --> stapel
  1287.     ld bc,80d        ;
  1288.     push bc            ;80d --> stapel
  1289.     call imul        ;(flop * 80) --> stapel
  1290.     call iadd        ;(flop *80)+(flip div 8) --> stapel
  1291.     pop bc            ;ergebnis --> stapel
  1292.     ld (address),bc        ;addres <-- ergebn.
  1293.     ld bc,(flip)        ;
  1294.     ld a,c            ;low-byte flip --> akku
  1295.     and 07h            ;(flip mod 8)--> akku
  1296.     ld c,a            ;(flip mod 8)--> c
  1297.     ld a,07h        ;7 in akku
  1298.     sub c            ;(7-(flip mod 8)) --> akku
  1299.     ld c,01h        ;2^0 --> c
  1300.     jp testf        ;expon=akku > 0 ?
  1301. againf:    dec a            ;exp -1
  1302.     sla c            ;2^0 *2
  1303. testf:    cp 00h            ;expon = 00 ?
  1304.     jp nz,againf        ;<> 0 --> 2^(i+1)
  1305.     ld b,00h        ;
  1306.     ld (value),bc        ;value <-- ergebnis
  1307.     ret            ;chiao
  1308.  
  1309.  
  1310. mnop:    ld bc,0d600h        ;
  1311.     ld iy,(apos)        ;
  1312.     ld a,(address+1)    ;
  1313.     ld (wert),a        ;
  1314.     ld a,18d        ;
  1315.     call sldv        ;
  1316.     ld a,(address)        ;
  1317.     ld (wert),a        ;
  1318.     ld a,19d        ;
  1319.     call sldv        ;
  1320.     ld a,31d        ;
  1321.     call srdv        ;
  1322.     ld (iy),a        ;
  1323.     inc iy            ;
  1324.     ld (apos),iy        ;
  1325.     ret            ;
  1326.  
  1327.  
  1328. lku:    ld bc,0d600h        ;
  1329.     ld iy,(apos)        ;
  1330.     ld a,(address+1)    ;
  1331.     ld (wert),a        ;
  1332.     ld a,18d        ;
  1333.     call sldv        ;
  1334.     ld a,(address)        ;
  1335.     ld (wert),a        ;
  1336.     ld a,19d        ;
  1337.     call sldv        ;
  1338.     ld a,(iy)        ;
  1339.     ld (wert),a        ;
  1340.  
  1341.  
  1342.     ld a,(xinv)
  1343.     cp 00h
  1344.     jr z,nxinv
  1345.     push bc
  1346.     ld c,11111111b
  1347.     ld a,(wert)
  1348.     xor c
  1349.     ld (wert),a
  1350.     pop bc
  1351. nxinv:  ld a,(xover)
  1352.     cp 00h
  1353.     jr z,dxver
  1354.     push de
  1355.     ld a,31d
  1356.     call srdv
  1357.     ld e,a
  1358.     ld a,(wert)
  1359.     or e
  1360.     ld (spvalue),a
  1361.     ld a,(address+1)
  1362.     ld (wert),a
  1363.     ld a,18d
  1364.     call sldv
  1365.     ld a,(address)
  1366.     ld (wert),a
  1367.     ld a,19d
  1368.     call sldv1
  1369.     ld a,(spvalue)
  1370.     ld (wert),a
  1371.     pop de
  1372.     
  1373. dxver:    ld a,31d
  1374.  
  1375.  
  1376.     call sldv        ;
  1377.     inc iy            ;
  1378.     ld (apos),iy        ;
  1379.     ret            ;
  1380.  
  1381.  
  1382. charO:  ld iy,(scradd)        ;startadr of array
  1383.     ld de,2000h        ;start address of VDC-char-ram
  1384.     ld hl,8192d        ;zaehler
  1385.     ld bc,0d600h        ;start of VDC-chip
  1386.     
  1387.     
  1388.         jp test1        ;fertig? <while schleife>
  1389.  
  1390. again1:    ld a,d            ;update-high-register
  1391.     ld (wert),a        ;
  1392.     ld a,18d        ;
  1393.     call sldv        ;
  1394.     ld a,e            ;
  1395.     ld (wert),a        ;
  1396.     ld a,19d        ;
  1397.     call sldv        ;
  1398.     ld a,31d        ;
  1399.     call rdv        ;
  1400.     ld (iy),a        ;
  1401.     inc de            ;next address in char-ram of VDC
  1402.     inc iy            ;next address in array charrom
  1403.     dec hl            ;zaehler-1
  1404. test1:    ld a,00            ;
  1405.     cp h            ;h=0?
  1406.     jp nz,again1        ;!=0 nicht fertig -> weiter
  1407.     cp l            ;h=0 and l=0 ?
  1408.     jp nz,again1        ;nein -> noch eine schleife
  1409.     ret            ;zurueck zu charO charI
  1410.  
  1411.  
  1412. charI:  ld iy,(scradd)        ;start of array
  1413.     ld de,2000h        ;start address of VDC-char-ram
  1414.     ld hl,8192d        ;zaehler
  1415.     ld bc,0d600h        ;start of VDC-chip
  1416.     
  1417.     jp test2        ;fertig? <while schleife>
  1418. again2:    ld a,d            ;update-high-register
  1419.     ld (wert),a        ;
  1420.     ld a,18d        ;
  1421.     call sldv        ;
  1422.     ld a,e            ;
  1423.     ld (wert),a        ;
  1424.     ld a,19d        ;
  1425.     call sldv        ;
  1426.     ld a,(iy)        ;
  1427.     ld (wert),a        ;
  1428.     ld a,31d        ;
  1429.     call ldv1        ;
  1430.     inc de            ;next address in char-ram of VDC
  1431.     inc iy            ;next address in array charrom
  1432.     dec hl            ;zaehler-1
  1433. test2:    ld a,00            ;
  1434.     cp h            ;h=0?
  1435.     jp nz,again2        ;!=0 nicht fertig -> weiter
  1436.     cp l            ;h=0 and l=0 ?
  1437.     jp nz,again2        ;nein -> noch eine schleife
  1438.     ret            ;                    
  1439.  
  1440.  
  1441. zaehlerpx:    ds 1
  1442.  
  1443. tab:        ds 8
  1444.  
  1445. tabl:        ds 8
  1446.  
  1447. aktzeiger:        ds 2
  1448.  
  1449. aktschleife:    ds 1
  1450.  
  1451. spsave:        ds 1
  1452.  
  1453. apos:    ds 2            ;
  1454.  
  1455. afpos:  ds 2            ;
  1456.  
  1457. reg25:    ds 1            ;
  1458.  
  1459. zaehler: ds 1            ;
  1460.  
  1461. zaeh1ler: ds 1            ;
  1462.  
  1463. save:    ds 1            ;register 26
  1464.  
  1465. memory:     ds 2            ;fuer 1 registerpaar
  1466.  
  1467. ret:     ds 2            ;fuer 1 ruecksprungaddresse
  1468.  
  1469. wert:    ds  1            ;
  1470.  
  1471. fcb:    db 00            ;
  1472.  
  1473. b1x8:    db    "CHARACTE"    ;
  1474.  
  1475. b9x11:    db    "HLP"        ;
  1476.  
  1477. b12:    db 00            ;
  1478.  
  1479. b13x31:    ds 19d            ;
  1480.  
  1481. b32:    db 00            ;
  1482.  
  1483. b33:    ds 1,00h
  1484.  
  1485. b34:    ds 1,00h
  1486.  
  1487. b35:    db 00h
  1488.  
  1489.  
  1490. fcb1:    db 00            ;
  1491.  
  1492. sb1x1: ds 1,'S'
  1493.  
  1494. sb1x2: ds 1,'C'
  1495.  
  1496. sb1x3: ds 1,'R'
  1497.  
  1498. sb1x4: ds 1,'E'
  1499.  
  1500. sb1x5: ds 1,'E'
  1501.  
  1502. sb1x6: ds 1,'N'
  1503.  
  1504. sb1x7: ds 1,'D'
  1505.  
  1506. sb1x8: ds 1,'P'
  1507.  
  1508. sb9x11:    db    "HLP"        ;
  1509.  
  1510. sb12:    db 00            ;
  1511.  
  1512. s13x31:    ds 19d            ;
  1513.  
  1514. sb32:    db 00            ;
  1515.  
  1516. sb32x35:    ds 3d        ;
  1517.  
  1518. myzl:    defs 1            ;myzl <=8 !
  1519.  
  1520. flip: ds 2
  1521.  
  1522. flop: ds 2
  1523.  
  1524. skox: ds 2
  1525.  
  1526. skoy: ds 2
  1527.  
  1528. ekox: ds 2
  1529.  
  1530. ekoy: ds 2
  1531.  
  1532. rhl: ds 2
  1533.  
  1534. sxret: ds 2
  1535.  
  1536. value:    ds 2
  1537.  
  1538. address:    ds 2
  1539.  
  1540. sadd:    ds 2
  1541.  
  1542. eadd: ds 2
  1543.  
  1544. mydma: ds 128,00h
  1545.  
  1546. scbpb: db 1,3ch
  1547.  
  1548. dset:  db 1,00h
  1549.  
  1550. dvalue: dw 1,0000h
  1551.  
  1552. olddma: db 2,0000h
  1553.  
  1554. rbc: ds 2,0000h
  1555.  
  1556. xinv: ds 1,00h
  1557.  
  1558. xover: ds 1,00h
  1559.  
  1560. linv: ds 1,00h
  1561.  
  1562. lover: ds 1,00h
  1563.  
  1564. spvalue: ds 1,00h
  1565.  
  1566. scradd: ds 2
  1567.  
  1568. memstart: ds 2
  1569.  
  1570.     end
  1571.  
  1572.  
  1573.             
  1574.  
  1575.