SUBTTL Bios (RPBIOS.ASM) v1.0,(C)26.11.90 OLEO TITLE REKLAMNI PANEL .Z80 ;M80 Source - Procesor je Z80A (Z8400) .XLIST IF1 INCLUDE RP.ASI INCLUDE RPFNAMES.ASI ENDIF .LIST .SALL PUBLIC RUN PUBLIC EDIT PUBLIC CRCOK PUBLIC OPEN EXTERNAL MVLEFT EXTERNAL WRITE EXTERNAL KEY EXTERNAL RSTXT EXTERNAL ISBRK EXTERNAL POCPTR POTIMEDLY EQU 100 CURSOR_SPEED EQU 350 ;Hitrost utripanja kurzorja pri editiranju CSEG ;Interpreter za display jezik ;Vhod: HL=kazalec na tekst ;Konec je takrat ko interpreter naleti na ukaz END, takrat je CY=1 ;ali pa ko je bila pritisnjena BREAK TIPKA -> CY=0 PNEXT: call FIND_SEMICOLON call ISBRK ret nc ;vrni se ~e je bila pritisnjena BREAK tipka PHARSE: call SKIP_FORM ;A<-(hl) and 0DFh ;~e je ~rka mala jo pretvori v veliko cp 'M' ;Move jr nz, ph0 push hl call MVLEFT pop hl jp PNEXT ph0: cp 'P' jr nz, ph1 call FIND_QUOTE ;Print text push hl pop de VBIOS POSTR db 0, NUL call FIND_QUOTE jr PNEXT ph1: cp 'W' jr nz, ph2 call FIND_QUOTE ;TeleType Print push hl call FIND_QUOTE call FIND_SEMICOLON call SKIP_FORM pop de ex de, hl push de call WRITE pop hl ld a,(hl) jr PHARSE+3 ph2: cp 'F' ;Flash jr nz, ph3 VBIOS FLASH db 0,1,NUL jr PNEXT ph3: cp 'I' ;Invert jr nz, ph4 VBIOS CPLPAGE db 0,NUL jr PNEXT ph4: cp 'C' ;Clear jr nz, ph5 VBIOS FILLPAGE db 0,0,NUL jr PNEXT ph5: cp 'S' ;Shift x=(Up, Dow, Left, Right) jr nz, ph6 call SKIP_ASC call SKIP_FORM cp 'U' ;Up jr nz, ph5_1 VBIOS SHIFTUP db 0,NUL jr PNEXT ph5_1: cp 'D' ;Down jr nz, ph5_2 VBIOS SHIFTDN db 0,NUL jp PNEXT ph5_2: cp 'L' ;Left jr nz, ph5_3 VBIOS SHIFTL db 0,NUL jp PNEXT ph5_3: cp 'R' ;Right jr nz, ph5_4 VBIOS SHIFTR db 0,NUL jp PNEXT ph5_4: jr $ ph6: cp 'T' ;Time jr nz, ph7 ld a,(TIMEDLY) ld b,a ph6_0: VBIOS POTIME db 0,NUL VBIOS VDELAY db 78,NUL djnz ph6_0 jp PNEXT ph7: cp 'D' ;Date jr nz, ph8 VBIOS PODATE db 0,NUL jp PNEXT ph8: cp 'B' ;Blink jr nz, ph9 VBIOS FILLPAGE db 1,0,NUL ld a,(FLASHDLY) ld b,a xor a VBIOS VDELAY db NUL VBIOS SETDPAGE db 1,NUL ld a,(FLASHDLY) ld b,a xor a VBIOS VDELAY db NUL VBIOS SETDPAGE db 0,NUL jp PNEXT ph9: cp 'H' ;Hold jr nz, ph10 call SKIP_ASC call SKIP_FORM call ASC_BYTE jp nc, PNEXT ;~e je neuspe{na konverzija VBIOS VDELAY db 0, NUL jp PNEXT ph10: cp 'E' ;End call ISBRK ret ;Poi{~e ustrezni karakter, ki je podan v A ;Izhod hl=kazalec na naslednji karakter in ne na A FIND_SEMICOLON: ld a, ';' jr FIND_CHAR FIND_SPACE: ld a,' ' jr FIND_CHAR FIND_QUOTE: ld a,'"' FIND_CHAR: ld bc,0FFFFh cpir ret ;poi{~e prvi ASCII znak ki je ve~ji od SPACE ;Vhod: hl=kazalec na text ;Izhod hl=kazalec na text, A=vrednost karakterja na kazalcu SKIP_FORM: ;poi{~e prvi znak ki je ve~ji od SPACE ld a,(hl) cp ' '+1 ret nc inc hl jr SKIP_FORM ;Delo obratno kot SKIP_FORM; poi{~e prvi znak ki je ve~ji od space SKIP_ASC: ld a,(hl) cp ' '+1 ret c inc hl jr SKIP_ASC ;~e je v Akumulatorju ASCII {tevilka vrne ugasnjen Carry IS_DIGIT: cp '0' ret c ;~e je manj kot 0 vrni CY cp '9'+1 ccf ;~e je ve~ kot 9 vrni CY ret ;Pretvori ASCII string v byte ;Vhod HL=kazalec na string ;Izhod A=prvi karakter, ki ni digit, B=rezultat konverzije ;CY=1 ~e je konverzija uspe{na, CY=0 ~e ni ASC_BYTE: ld b, 0 ;za~etna vrednost je 0 call SKIP_FORM ;presko~i za~etne BLANKe call IS_DIGIT jr nc, ascbyt ;~e je prva {t cifra je OK VBIOS POERROR dw edigit db NUL ccf ret edigit: DEFM "#1 Digit?""" ascbyt: ld a, (hl) call IS_DIGIT ;ali je cifra ret c ;~e ni cifra se vrni sub '0' ;odstej '0' ld c,a ;za~asno shrani A v C ld a,b ;mno`i B=B*10 sla a sla a add a, b sla a add a,c ;pri{tej {e zadnjo cifro ld b,a ;shrani v b inc hl ;pove~aj kazalec jr ascbyt ;ponavljaj do zadnje cifre ;Izra~una kontrolno vsoto bloka v ramu ;Vhod: HL=za~etek bloka, BC={tevilo bytov (velikost bloka) ;Izhod: DE=kontrolna vsota bloka CRC: ld de, 0000h ;za~etna vsota je 0 csum: ld a,(hl) add a,e ld e,a ld a,0 adc a,d ld d,a inc hl dec bc ld a,b or c jr nz, csum ret ;Napravi kontrolno vsoto teksta ;Izhod: DE=CRC oz. kontrolna vsota GET_TXT_CRC: ld hl,(TXTEND) ld de,TXTBEG and a sbc hl,de ld b,h ld c,l ld hl,TXTBEG call CRC ret ;Napravi kontrolno vsoto teksta in ga primerja s shranjeno CRC vsoto ;Izhod: ZF=1 ~e je vsota OK CRCOK: call GET_TXT_CRC ld hl,(TXTCRC) and a sbc hl,de ret UPDATE_TXT_CRC: call GET_TXT_CRC ld (TXTCRC),de ret ;Kopira string iz (DE)<--(HL) dokler ni (HL)==0 CPYSTR: ldi ld a,(hl) cp 0 jr nz, cpystr ret ;Naredi prostor za eno ~rko v TEXTRAMU ;Izhod: CY=1 ~e ni mo`no alocirati spomina za ~rko ONE_SPACE: ld hl,TXTLAST-1 ;Ali je prostor se za eno ~rko ld bc,(TXTEND) and a sbc hl,bc ret c ld hl,(TXTEND) ld bc,(CPTR) and a sbc hl,bc ld b,h ld c,l ;Byte Counter je velikost bloka inc bc ld hl,(TXTEND) ld d,h ld e,l inc de ld (TXTEND),de ;TXTEND je ve~ji za ena lddr ;prenesi blok ret ;Izbri{e en prostor ni`je od trenutnega kazalca CPTR v TEXTRAMU ;Izhod: CY=1 ~e ni mo`no brisati- za~etek BACKSP: ld hl,(CPTR) ld bc,TXTBEG+1 and a sbc hl,bc ret c ;vrni pri`gan CY ~e smo na za~etku teksta ld hl,(TXTEND) ld bc,(CPTR) and a sbc hl,bc ld b,h ld c,l ;BC je velikost bloka ld hl,(CPTR) ;izvor ld d,h ld e,l dec de ;cilj je eno lokacijo ni`je ld (CPTR),de ;kazalec CPTR se zmanj{a ldir ;prenesemo blok dec hl ld (TXTEND),hl ;kakor tudi TXTEND and a ret ;Vrine ~rko v TEXTRAMU ;Vhod A=ASCII koda ~rka ;Izhod: CY=1 ~e je alokacija spomina neuspe{na ; CY=0 ~e je OK INSA: push af call ONE_SPACE pop af ret c ld hl, (CPTR) ld (hl),a inc hl ld (CPTR), hl and a ret CURSOR_LEFT: ld hl,(CPTR) ld de, TXTBEG+1 and a sbc hl,de ret c ld hl,(CPTR) dec hl ld (CPTR),hl ret CURSOR_RIGHT: ld hl,(TXTEND) ld de, VIDEOPORTS/2+1 and a sbc hl,de ld de,(CPTR) and a sbc hl,de ret c ld hl,(CPTR) inc hl ld (CPTR),hl ret CURSOR_PgDn: ld hl,(CPTR) ld de, TXTBEG+1+VIDEOPORTS and a sbc hl,de ret c ld hl,(CPTR) ld de,VIDEOPORTS and a sbc hl,de ld (CPTR),hl ret CURSOR_PgUp: ld hl,(TXTEND) ld de, VIDEOPORTS/2+1+VIDEOPORTS and a sbc hl,de ld de,(CPTR) and a sbc hl,de ret c ld hl,(CPTR) ld de, VIDEOPORTS add hl,de ld (CPTR),hl ret CURSOR_HOME: ld hl,TXTBEG ld (CPTR),hl ret CURSOR_END: ld hl,(TXTEND) ld de,VIDEOPORTS/2 and a sbc hl,de ld (CPTR),hl ret ;Inicializira spremenljivke in odpre stream za tekst ;Vhod: ni~, Izhod: Ni~ OPEN: ld hl,TXTBEG ld (CPTR),hl ex de,hl ld hl,open_end call CPYSTR ld (TXTEND),de ld de,TXTBEG-VIDEOPORTS/2 ld hl,open_start call CPYSTR call UPDATE_TXT_CRC ret open_start: REPT VIDEOPORTS/2 DEFB '>' ENDM DEFB 0 open_end: DEFM ";End" REPT VIDEOPORTS/2-4 DEFB ' ' ENDM DEFB 0 RUN: ld hl,TXTBEG call PHARSE jr c,run ret EDIT: enext: call POCPTR call UPDATE_TXT_CRC ecurs: ld hl,CURSOR_SPEED eloop: dec hl ld a,h or l jr nz,ekey VBIOS CURSOR db VIDEOPORTS/2, NUL jr ecurs ekey: call KEY jr c, eloop cp 0 jr z,espec call INSA jr enext espec: ld a,c cp 0Eh jr nz,left call BACKSP jr enext left: cp 4Bh jr nz, right call CURSOR_LEFT jr enext right: cp 4Dh jr nz,pgdn call CURSOR_RIGHT jr enext pgdn: cp 51h jr nz,pgup call CURSOR_PgDn jr enext pgup: cp 49h jr nz,home call CURSOR_PgUp jr enext home: cp 47h jr nz,eend call CURSOR_HOME jr enext eend: cp 4Fh jr nz,erun call CURSOR_END jr enext erun: cp 3Bh ;F1 jr nz,eopen call UPDATE_TXT_CRC VBIOS CLRPAGES DB NUL call RUN jr enext eopen: cp 3Fh ;F5 jr nz,etime call OPEN jr enext etime: cp 40h ;F6 jr nz,edate call EDIT_TIME jp enext edate: cp 41h ;F7 jp nz,enext call EDIT_DATE jp enext EDIT_TIME: VBIOS CLRPAGES DB NUL ld a,10 ld (TIMECURSOR),a ;nastavi pozicijo kurzorja na prvo mesto VBIOS POTIME DB 0,NUL tcurs: ld hl,CURSOR_SPEED tloop: dec hl ld a,h or l jr nz,tkey ld a,(TIMECURSOR) VBIOS CURSOR db NUL jr tcurs tkey: call KEY jr c, tloop cp 0 jr z,tloop call IS_DIGIT jr c,tloop ld c,a sub '0' push af ;za~asno shrani na sklad {tevilko ld a,(TIMECURSOR) ld b,0 ;stran {t. 0 VBIOS GOTOX db NUL ld a,c VBIOS PO_CHAR db NUL ld a,(TIMECURSOR) tcpdec: dec a ld (TIMECURSOR),a cp 8 ;presko~i mesto 8 jr z,tcpdec cp 5 ;kakor tudi 5. jr z,tcpdec cp 2 jr nz,tcurs ;sko~i, ~e ni konec vstavljanja podatov IRPC register,hldeba pop af ld register,a ENDM VBIOS SETRTC db NUL VBIOS SETTIME db NUL ret EDIT_DATE: VBIOS CLRPAGES DB NUL ld a,9 ld (TIMECURSOR),a ;nastavi pozicijo kurzorja na prvo mesto dnext: VBIOS PODATE DB 0,NUL dcurs: ld hl,CURSOR_SPEED dloop: dec hl ld a,h or l jr nz,dkey ld a,(TIMECURSOR) VBIOS CURSOR db NUL jr dcurs dkey: call KEY jr c, dloop cp 0 jr z,dloop call IS_DIGIT jr c,dloop ld c,a sub '0' push af ;za~asno shrani na sklad {tevilko ld a,(TIMECURSOR) ld b,0 ;stran {t. 0 VBIOS GOTOX db NUL ld a,c VBIOS PO_CHAR db NUL ld a,(TIMECURSOR) dcpdec: dec a ld (TIMECURSOR),a cp 8 jr nz,dcnxt pop af ;najprej se nastavi dan v tednu VBIOS SETDAY db NUL jr dnext dcnxt: cp 6 ;presko~i 6. in jr z,dcpdec cp 3 ; 3. mesto jr z,dcpdec cp 0 jr nz,dcurs ;sko~i, ~e ni konec vstavljanja podatov IRPC register,hldeba pop af ld register,a ENDM VBIOS SETRTC db NUL VBIOS SETDATE db NUL ret commands: DEFM "Print""Slavko Pirman"";Blink;S D;" DEFM "Write""Sprejem TV sprejemnikov"";" DEFM "Move;Hold 10;Time;T;T;T;Date;Hold 12;Shift Up;End;" END