antoine-source/showoff/SOURCE.2/SHOWSHOW.S
2024-07-03 22:02:00 +02:00

1867 lines
50 KiB
ArmAsm

;...............................................................
;
; FILE : SHOWSHOW.S -Show-
; ----------
;...............................................................
;...............................................................
;
; SeShow : Appele par le sequence editor
;
;...............................................................
DoShow START
Using GlobalData
Using WindowData
Using SeqEditData
;--
PushLong #0
_GetPort
PushLong #0
PushLong #RectShow
PushLong #0
PushLong #$FFFFFFFF
PushWord #$2020
PushLong #15
PushLong #RectShow
_NewModelessDialog
pla |son pointeur
sta Ptr_ShowD
pla
sta Ptr_ShowD+2
PushLong Ptr_ShowD
_SetPort
PushLong Ptr_ShowD
PushLong #ShowD0
_GetNewDItem
PushLong Ptr_ShowD
PushLong #ShowD1
_GetNewDItem
PushLong Ptr_ShowD
PushLong #ShowD2
_GetNewDItem
PushLong Ptr_ShowD
PushLong #ShowD3
_GetNewDItem
PushLong Ptr_ShowD
PushLong #ShowD4
_GetNewDItem
PushLong Ptr_ShowD
PushLong #ShowD5
_GetNewDItem
PushLong Ptr_ShowD
PushLong #ShowD6
_GetNewDItem
PushLong Ptr_ShowD |Edit Line
PushLong #ShowD7
_GetNewDItem
PushLong Ptr_ShowD |Edit Line
PushLong #ShowD8
_GetNewDItem
;--
stz StopShow
stz ShowOnOff |pas encore de show
stz Show_Present |pas encore de pleine page
stz JTF |pas de goto Frame
stz Reprise_Show
stz Mode_Slide
lda #Mode_Auto
sta Mode_Show
;--
again ANOP
PushWord #0
PushWord #$1FFF
PushLong #EventRecord
_GetNextEvent
pla
beq Sagain
;--
HdlEvent ANOP
jsr Caract_Bon
bcs again
;--
Sagain PushWord #0
PushLong #EventRecord
PushLong #Ptr_ShowD
PushLong #SSItemIt
_DialogSelect
pla
beq again
;--
lda SSItemIt
sec
sbc #10
asl a
tax
jsr (tableShow,x)
lda StopShow
beq again
;--
Finish PushLong >Ptr_ShowD |on ferme
_CloseDialog
;--
FDoShow _SetPort
rts
;--------------------------------------
; Table d'indirection
;--------------------------------------
TableShow ANOP
dc i'SHIgnore' |0
dc i'SHOk' |1
dc i'SHCancel' |2
dc i'SHAuto' |3
dc i'SHTime' |4
dc i'SHManuel' |5
dc i'SHIgnore' |6
dc i'SHJTF' |7
dc i'SHTIME' |8
;--------------------------------------
; Ne Rien Faire
;--------------------------------------
SHIgnore ANOP
rts
;--------------------------------------
; Ok pour le Show
;--------------------------------------
SHOk ANOP
PushLong Ptr_ShowD
PushWord #14
PushLong #Val_Time
_GetIText
lda Val_Time
and #$00FF
bne okval
lda #0
sta Time_Show
bra sSHOK
;--
OkVal PushWord #0
PushLong #Val_Time+1
lda Val_Time
and #$00FF
pha
PushWord #0
_Dec2Int
pla
PushLong #0 |Convertir en 60 eme (tick)
pha
PushWord #60
_Multiply
pla
plx
sta Time_Show
;--
sSHOK ANOP |le goto Frame
;--
lda #1 |got frame 1 option
sta JTF_Show
;--
lda JTF
beq S0OkFra
;--
PushLong Ptr_ShowD
PushWord #18
PushLong #Val_Frame
_GetIText
lda Val_frame
and #$00FF
beq S0OkFra
;--
Okfra PushWord #0
PushLong #Val_Frame+1
lda Val_Frame
and #$00FF
pha
PushWord #0
_Dec2Int
pla
beq S000OkFra
cmp Sequ_HMFrame
beq S00OkFra
bcc S00OkFra
;--
S000OkFra jsr F_No_Exist
bra Refus_ok
;--
S00OkFra sta JTF_Show
;--
S0OkFra Inc StopShow
lda #1
sta ShowOnOff
sta QuitSeqEd
Refus_ok rts
;--------------------------------------
; Cancel Pas De Show
;--------------------------------------
SHCancel ANOP
Inc StopShow
lda #0
sta ShowOnOff
rts
;--------------------------------------
; Mode Automatique
;--------------------------------------
SHAuto ANOP
PushWord #1
PushLong Ptr_ShowD
PushWord #13
_SetDItemValue
lda #Mode_Auto
sta Mode_Show
rts
;--------------------------------------
; Ajuste le Temps
;--------------------------------------
SHTime ANOP
rts
;--------------------------------------
; Mode Manuel
;--------------------------------------
SHManuel ANOP
PushWord #1
PushLong Ptr_ShowD
PushWord #15
_SetDItemValue
lda #Mode_Manuel
sta Mode_Show
rts
;--------------------------------------
; Jump To Frame
;--------------------------------------
SHJTF ANOP
;--
lda JTF
eor #$1
sta JTF
;--
pha
PushLong Ptr_ShowD
PushWord #17
_SetDItemValue
rts
;--------------------------------------
; Caract_Bon
;--------------------------------------
Caract_Bon ANOP
lda EventWhat
cmp #3
beq Test_key
cmp #5
beq Test_key
Accept_Key clc
rts
;--
Test_Key lda EventMessage
cmp #Key_return
beq Refus_Key
cmp #Key_Delete
beq Accept_Key
cmp #Key_fg
beq Accept_Key
cmp #Key_fd
beq Accept_Key
cmp #$09 |tab
beq Accept_key
cmp #$18
beq Accept_Key
cmp #$30
bcc Refus_Key
cmp #$3A
bcc Accept_Key
;--
Refus_Key sec
rts
;--------------------------------------
; REfus frame no existe
;--------------------------------------
F_No_Exist ANOP
lda #Txt_FNE
sta ItemAp2tx
lda #^Txt_FNE
sta ItemAp2tx+2
lda #Str_Bl
sta ItemAp3tx
lda #^Str_Bl
sta ItemAp3tx+2
jsr Ok_Alert
_InitCursor
rts
;--------------------------------------
; DATA
;--------------------------------------
Reprise_Show ds 2
StopShow ds 2
Val_Time dc i1'2',c'05' |5 seconds
Val_Frame dc i1'2',c'01' |1ere frame
Mode_Slide ds 2
Mode_Show ds 2
Mode_Auto equ 0
Mode_Manuel equ 1
RectFg dc i'0,0,200,8'
RectFd dc i'0,312,200,321'
RectShow dc i'35,30,160,290'
Ptr_ShowD ds 4
SSItemIt ds 2
JTF dc i'0' |pas de jtf
JTF_Show ds 2
;--------------------------------------
; SHOW DIALOG
;--------------------------------------
ShowD0 anop |Show
dc i'10'
dc i'10,114,23,219'
dc i'StatText+ItemDisable'
dc i4'Str_Show'
dc i'0'
dc i'0'
dc i4'0'
;--
ShowD1 anop |Ok
dc i'11'
dc i'103,44,118,99'
dc i'ButtonItem'
dc i4'Str_Ok'
dc i'0'
dc i'0'
dc i4'0'
;--
ShowD2 anop |Cancel
dc i'12'
dc i'103,161,118,216'
dc i'ButtonItem'
dc i4'Str_Cancel'
dc i'0'
dc i'0'
dc i4'0'
;--
ShowD3 anop |Auto
dc i'13'
dc i'32,35,46,146'
dc i'RadioItem'
dc i4'Str_Auto'
dc i'1'
dc i'3'
dc i4'0'
;--
ShowD4 anop |Edit Time
dc i'14'
dc i'32,205,46,231'
dc i'EditLine'
dc i4'Val_Time'
dc i'2'
dc i'0'
dc i4'0'
;--
ShowD5 anop |Manuel
dc i'15'
dc i'51,35,65,146'
dc i'RadioItem'
dc i4'Str_Manuel'
dc i'0'
dc i'3'
dc i4'0'
;--
ShowD6 anop |text time
dc i'16'
dc i'35,166,49,201'
dc i'StatText+ItemDisable'
dc i4'Str_Time'
dc i'0'
dc i'0'
dc i4'0'
;--
ShowD7 anop |Jump to frame
dc i'17'
dc i'78,35,93,160'
dc i'CheckItem'
dc i4'Str_JTF'
dc i'0'
dc i'0'
dc i4'0'
;--
ShowD8 anop |Edit Frame
dc i'18'
dc i'78,180,93,206'
dc i'EditLine'
dc i4'Val_Frame'
dc i'2'
dc i'0'
dc i4'0'
;...............................................................
;
; DoShowActif
;
;...............................................................
DoShowActif ENTRY
lda ShowOnOff
bne SDSA
rts
;--
SDSA lda Reprise_Show
bne SDSA2
lda Show_Present
beq SDSA1
rts
;--
SDSA1 ANOP |Debut Du Show
lda JTF_Show |1 er Frame
sta Sequ_NbFrame
jsr LoadCurFrame
jsr PCompute_RFrame
jsr Flip_FullPage
jsr MenuBarOff |++++ NEW 10/11/87
;--
s_SDSA1 lda #1
sta Show_Present
jsr Init_Time_Out |temps d'ecoulement
stz Reprise_Show
rts
;--
SDSA2 ANOP
lda JTF_Show |1 er Frame
sta Sequ_NbFrame
jsr LoadCurFrame
jsr PCompute_RFrame
bra s_SDSA1
;...............................................................
;
; Key_In_show
;
;...............................................................
Key_In_Show ENTRY
lda EventMessage
cmp #$1B |escape
beq Fin_Du_Show
cmp #Key_Fd
beq Page_Suivante
cmp #Key_Fg
bne SKIS
brl Page_Avant
;--
SKIS jsr Direction_Key
bcc Page_Suivante
;--
rts
;--
Fin_Du_Show ANOP
;--
jsr Un_Select
jsr Raz_Select
jsr DoShow
;--
lda ShowOnOff
beq OkFDS
;--
lda #1
sta Reprise_Show
;--
KoFDS PushLong #0
_GetPort
PushLong Ptr_FrameW
_SetPort
PushLong #FullRect
_InvalRect
_SetPort
rts
;--
OkFDS lda #0
sta ShowOnOff
sta Show_Present
jsr Un_Select
jsr Raz_Select
jsr MenuBarOn
jsr Flip_FullPage
jsr Del_Undo
jsr Recal_Menu
stz Top_Action
bra KoFDS
;--
Page_Suivante ANOP
;--
jsr Trt_Send_Serie
;--
lda Frame_Transit+4
sta Mode_Slide
;--
lda Sequ_NbFrame
inc a
cmp Sequ_HMFrame
bcc SPS
beq SPS
clc
rts
;-
SPS sta Sequ_NbFrame
jsr LoadCurFrame
jsr PCompute_RFrame
jsr Raz_Select
;--
jsr Call_Slide
;--
jsr Init_Time_Out
sec
rts
;--
Page_Avant ANOP
;--
jsr Trt_Send_Serie
;--
lda Frame_Transit+4
sta Mode_Slide
;--
lda Sequ_NbFrame
dec a
bne SPA
clc
rts
;-
SPA sta Sequ_NbFrame
jsr LoadCurFrame
jsr PCompute_RFrame
jsr Raz_Select
jsr Call_Slide
jsr Init_Time_Out
sec
rts
;--------------------------------------
; PCompute_RFrame
;--------------------------------------
PCompute_RFrame ANOP
lda Status_Number
beq FPCF
jsr Compute_RFrame
FPCF rts
;...............................................................
;
; Direcion_Key
;
;...............................................................
Direction_Key ANOP
lda EventMessage
xba
;--
jsr UpperCase
;--
ldy #10
ldx Frame_Transit+6
cmp Frame_Transit+8
beq Goto
ldy #16
ldx Frame_Transit+12
cmp Frame_Transit+14
beq Goto
ldy #22
ldx Frame_Transit+18
cmp Frame_Transit+20
beq Goto
ldy #28
ldx Frame_Transit+24
cmp Frame_Transit+26
beq Goto
;--
jsr YaDuCar |si des caracteres alors pas de
bcc NonGoto |goto automatique page suivante
rts
;--
NonGoto clc
rts
;--
Goto ANOP
;--
jsr Trt_Send_Serie
;--
lda Frame_Transit,y
sta Mode_Slide
;--
txa
beq NonGoto
cmp Sequ_HMFrame
bcc OkGoto
bne NonGoto
;--
OkGoto brl SPS
;--------------------------------------
; YaduCar
;--------------------------------------
YaDuCar ENTRY
lda Frame_Transit+8
bne YenA
lda Frame_Transit+14
bne YenA
lda Frame_Transit+20
bne YenA
lda Frame_Transit+26
bne YenA
clc
rts
YenA sec
rts
;--------------------------------------
; UpperCase
;--------------------------------------
UpperCase ANOP
cmp #$6100 |compris entre a et z
bcc FUC
cmp #$7B00
bcs FUC
and #$DF00
FUC rts
;...............................................................
;
; Click_In_Show
;
;...............................................................
Click_In_Show ENTRY
PushWord #0
PushLong #EventWhere
PushLong #RectFg
_PtInRect
pla
beq SCIS0
brl Page_Avant
SCIS0 PushWord #0
PushLong #EventWhere
PushLong #RectFd
_PtInRect
pla
beq SCIS
brl Page_suivante
SCIS clc
rts
;...............................................................
;
; Init_Time_Out
;
;...............................................................
Init_Time_Out ENTRY
PushLong #0
_TickCount
pla
clc
adc Time_Show
sta Timing_Out
pla
clc
adc #0
sta Timing_Out+2
rts
;...............................................................
;
; DoAutomatique
;
;...............................................................
DoAutoMatique ENTRY
;--
lda ShowOnOff
beq KODAM
lda Show_Present
bne OKSDAM
KODAM rts
;--
OKSDAM lda Mode_Show
cmp #Mode_Auto
beq SDAM
rts
;--
SDAM PushLong #0
_TickCount
pla
sta Zcount
pla
sta Zcount+2
;--
lda Zcount
sec
sbc Timing_Out
sta Zcount
lda Zcount+2
sbc Timing_Out+2
sta Zcount+2
;--
lda Zcount
bmi FDAM
;--
jsr Page_Suivante
bcs FDAM
;--
lda #0
sta Sequ_NbFrame
jsr Page_Suivante
;--
FDAM rts
;...............................................................
;
; Call_Slide : Slide Effect
;
;...............................................................
Call_Slide ENTRY
lda #1
sta Top_Bitmap
sta Force_Bitmap
jsl Maj_FrameW
_HideCursor
PushLong Ptr_Fond
PushLong #$E12000
PushLong #FullRect
PushLong #FullRect
PushWord Mode_Slide
;--
lda #9
sta SegNumber
jsr Disk_Present
;--
JSL DoSlideR
;--
PushWord MyID |RETIRER LA DEALLOCATION
pea 1
pea 9
_UnLoadSegNum
;--
; pha
; pha
; PushLong Ptr_Pzero
; _FindHandle
; _PurgeHandle
;--
lda #1
sta NoTextShow
sta Force_bitmap
sta Top_bitmap
jsl maj_frameW
stz NoTextShow
;--
_ShowCursor
rts
;...............................................................
;
; Trt_Send _Serie : Envoi des ordres series
;
;...............................................................
Trt_Send_Serie ENTRY
lda Frame_Serie
beq FTSS
jsr Setup_Serie
lda Hdl_Orders
ldx Hdl_Orders+2
jsr Deref
sta Ptr_Orders
stx Ptr_Orders+2
lda [Ptr_Orders] |1 ligne au moins
beq FTSS0
;--
jsr Send_Serie |envoyer la sauce
;--
FTSS0 lda Hdl_Orders
ldx Hdl_Orders+2
jsr Unlock
FTSS rts
;...............................................................
;
; Setup_Serie : init Serial Port
;
;...............................................................
Setup_Serie ENTRY
lda ParamSerie+8
sta Cr_Printer
lda #$0200 |PRINTER
ldy Paramserie
tax
tya
asl a
tay
txa
ora Tab_Baud,y
ldy ParamSerie+2
tax
tya
asl a
tay
txa
ora Tab_Bits,y
ldy ParamSerie+4
tax
tya
asl a
tay
txa
ora Tab_Parity,y
ldy ParamSerie+6
tax
tya
asl a
tay
txa
ora Tab_Stop,y
pha
jsl SetLine1Param
;--
lda ParamSerie+18
sta Cr_Modem
lda #$0200 |MODEM
ldy Paramserie+10
tax
tya
asl a
tay
txa
ora Tab_Baud,y
ldy ParamSerie+12
tax
tya
asl a
tay
txa
ora Tab_Bits,y
ldy ParamSerie+14
tax
tya
asl a
tay
txa
ora Tab_Parity,y
ldy ParamSerie+16
tax
tya
asl a
tay
txa
ora Tab_Stop,y
pha
jsl SetLine2Param
rts
;...............................................................
;
; Send_Serie
;
;...............................................................
Send_Serie ENTRY
sta Nb_Ligne_Serie
lda Ptr_Orders
clc
adc #2
sta Ptr_Orders
lda Ptr_Orders+2
adc #0
sta Ptr_Orders+2
;--
RSS jsr Send1Ligne
jsr Wait1Ligne
;--
lda Ptr_Orders
clc
adc #40
sta Ptr_Orders
lda Ptr_Orders+2
adc #0
sta Ptr_Orders+2
;--
Dec Nb_Ligne_Serie
bne RSS
rts
;...............................................................
;
; Send1Ligne
;
;...............................................................
Send1Ligne ENTRY
;--
ldy #38 |copie ligne dans buffer travail
RS1L lda [Ptr_Orders],y
sta LigneSerie,y
dey
dey
bpl RS1L
;--
lda [Ptr_Orders]
and #$00FF
sta Lg_LigneSerie
;--
sep #$20
longa off
ldy #0
R0S1L lda LigneSerie+1,y
jsr Trt_Caract
bcs Err_Out
phy
jsr Send_SSC
sep #$20
ply
iny
cpy lg_LigneSerie
bcc R0S1L
;--
rep #$20
jsr Send_Cr
;--
Err_Out rep #$20
rts
;--------------------------------------
;-------- Trt_Caract ------------------
;--------------------------------------
Trt_Caract cmp #$11
beq S0Trt_Caract
cmp #$13
bne normal
brl Err_Pomme
;--
normal clc
rts
;--
S0Trt_Caract ldx #0
RTrt_Caract iny
cpy lg_LigneSerie
bcs err_Pomme
lda LigneSerie+1,y
cmp #$11
beq STrt_Caract
cpx #3
bcs Err_Pomme
sta TabCar,x
inx
bra RTrt_caract
strt_Caract rep #$20
longa on
phy
PushWord #0
PushLong #TabCar
phx
PushWord #0
_Dec2Int
pla
ply
sep #$20
longa off
bcs Err_Pomme
clc
rts
Err_Pomme sec
rts
;--------------------------------------
;-------- Send Serie ------------------
;--------------------------------------
Send_SSC ENTRY
rep #$20
longa On
and #$00FF
sta OctetToSend
;--
lda Ls_ModemPrint
beq Send_SSC_M
;--
Send_SSC_P PushLong #OctetToSend
PushLong #1
jsl SendLine1
rts
;--
Send_SSC_M PushLong #OctetToSend
PushLong #1
jsl SendLine2
rts
;...............................................................
;
; Wait1Ligne
;
;...............................................................
Wait1Ligne ENTRY
lda Ls_Wait
bne SW1L
rts
;--
SW1L lda Ls_ClickTime
bne WaitTime
;--
WaitClick ANOP
lda Mode_Show
cmp #Mode_Auto
beq WaitAuto
;-
RWC PushWord #0
PushWord #0
_StillDown
pla
bne RWC
RWC0 PushWord #0
PushWord #0
_Button
pla
beq RWC0
rts
;-
WaitAuto ANOP |idem que Time Show
jsr Init_Time_Out
jsr WaitForSerie
rts
;--
WaitTime ANOP |Calcul time Show demande
PushLong #0
PushWord Ls_Time
PushWord #60
_Multiply
pla
plx
sta Time_Show
jsr Init_Time_Out
jsr WaitForSerie
rts
;--------------------------------------
;-------- WaitForSerie ----------------
;--------------------------------------
WaitForSerie ENTRY
PushLong #0
_TickCount
pla
sta ZCount
pla
sta ZCount+2
;--
lda Zcount
sec
sbc Timing_Out
sta ZCount
lda ZCount+2
sbc Timing_Out+2
sta ZCount+2
;--
lda ZCount
bmi WaitForSerie
;--
rts
;--------------------------------------
;-------- Send_Cr ---------------------
;--------------------------------------
Send_Cr ENTRY
lda Ls_ModemPrint
beq Send_CR_MD
;--
Send_Cr_Pr ANOP
lda Cr_Printer
beq FSCR
lda #$0D
sta OctetToSend
PushLong #OctetToSend
PushLong #1
jsl SendLine1
FSCR rts
;--
Send_Cr_MD ANOP
lda Cr_Modem
beq FSCR
lda #$0D
sta OctetToSend
PushLong #OctetToSend
PushLong #1
jsl SendLine2
rts
;...............................................................
;
; Data des series
;
;...............................................................
Tab_Baud dc i'$0006,$0008,$000A,$000C,$000E,$000F'
Tab_Bits dc i'$0000,$0010'
Tab_Stop dc i'$0000,$0040'
Tab_Parity dc i'$0000,$0180,$0080'
Cr_Printer ds 2
Cr_Modem ds 2
Nb_Ligne_Serie ds 2
lg_LigneSerie ds 2
LigneSerie ds 32
LS_Wait ds 2
LS_ClickTime ds 2
LS_ModemPrint ds 2
LS_Time ds 2
OctetToSend ds 2
TabCar dc c' '
END
*******************************************************************************
* *
* SERIAL.S source sous programme emision sur ligne serie 1 et 2 *
* *
* CREALUDE (C) 1987 *
* *
* PIETRO PANCINO FECIT ANNO 1987 *
*******************************************************************************
serial START
*******************************************************************************
* *
* Setline1param (PRINTER PORT) *
* *
* in: 2 octets *
* word init for line 1 *
* *
* out: no *
* *
* erreur 1 pas trouver la carte serie dans slot 1 *
* *
*******************************************************************************
Setline1param entry
ctrprinter equ $9
ctrmodem equ $1
long
lda 4,s
sta >format
lda 2,s
sta 4,s ; recup PF
lda 0,s
sta 2,s ; recup bk et Pf
tsc
clc
adc #2 ; remonte 4 le sp
tcs ; new value for stack
phd
phb
phk
plb ; set my data bank
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; test if i/o card in slot 1
lda >$000000c10c ; adresse signature
and #$00FF ; ecrase le poids fort
cmp #$0031 ; serial card
beq set0
lda #$0001
trb flag
brl setf
set0 anop
lda #$0001
tsb flag ; interface active
jsl line1 ; init vector for line one
lda #0
sta transit ; init value pour readbparam li 1 e
; entree du programme de traitement des flags
setentry anop ; point entre pour line 2
pushword #0
pushword transit ; line 1 printer or modem
_readbparam
pla
bne set3
lda #ctrprinter ; this is a printer chanel line 1
sta ctrcode
bra set4
set3 anop
lda #ctrmodem ; this is a modem chanel line 1
sta ctrcode
set4 anop
; first of all RESET
jsl initline ; init routine in rom line 1
ldx #0
; baud rate
lda ctrcode ; communication mode
sta writebuffer,x
inx
lda format
and #$000F
cmp #$000A
bcs baud1 ; value >= $A
ora #$0030 ; make an ascii string$
sta writebuffer,x
inx
bra baudf
baud1 anop
pha
lda #$31 ; 1
sta writebuffer,x
inx
pla
and #$0007
dec a
dec a
ora #$0030
sta writebuffer,x
inx
baudf anop ; fin
lda #$0D42 ; baud command B CR
sta writebuffer,x
inx
inx
stx writelenght
jsl writestring
jsl disabbuff
; data format
lda ctrcode ; communication mode
sta writebuffer,x
inx
lda format
and #$0030 ; XD
lsr a
lsr a
lsr a
lsr a
ora #$0030 ; make ascii
sta writebuffer,x
inx
lda #'D' ; data format
sta writebuffer,x
inx
stx writelenght
jsl writestring
jsl disabbuff
; parity
lda ctrcode ; communication mode
sta writebuffer,x
inx
lda format
and #$0180 ; XP
phx
ldx #7 ; count
par1 anop
lsr a ; decale 7 foi
dex
bpl par1
plx
ora #$0030 ; make ascii
sta writebuffer,x
inx
lda #'P'
sta writebuffer,x
inx
stx writelenght
jsl writestring
jsl disabbuff
; disable line feed
linefeed anop
lda ctrcode
sta writebuffer,x
inx
lda #'DL'
sta writebuffer,x
inx
inx
; only ascii or hex data
ascii anop
lda format
and #$0200
beq asciif
lda ctrcode
sta writebuffer,x
inx
lda #'Z'
sta writebuffer,x
inx
lda #$000D ; cr
sta writebuffer,x
inx
stx writelenght
jsl writestring
asciif anop
set5 anop
lda #0 ; noerror
setf entry
cmp #1
plb
pld
rtl
*******************************************************************************
* *
* Setline2param (modem PORT) *
* *
* in: 2 octets *
* word init for line 2 *
* *
* out: no *
* *
* erreur 2 pas trouver la carte serie dans slot 2 *
* *
*******************************************************************************
Setline2param entry
long
lda 4,s
sta >format
lda 2,s
sta 4,s ; recup PF
lda 0,s
sta 2,s ; recup bk et Pf
tsc
clc
adc #2 ; remonte 4 le sp
tcs ; new value for stack
phd
phb
phk
plb ; set my data bank
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; test if i/o card in slot 2
lda >$000000c20c ; adresse signature
and #$00FF ; ecrase le poids fort
cmp #$0031 ; serial card
beq setline20
lda #$0002
trb flag
brl setf
setline20 anop
lda #$0002
tsb flag ; interface active
jsl line2 ; init vector for line one
lda #$000C
sta transit ; init value pour readbparam li 1 e
brl setentry ; entree traitement
*******************************************************************************
* *
* Sendline1 *
* *
* in: 8 octets *
* long pointeur sur buffer de sortie *
* long compteur de caracteres *
* *
* out: no *
* *
* error 3 carte serie non presente end slot1 *
* error 4 init voie serie non effectuee *
* *
*******************************************************************************
sendline1 entry
ptr equ 8
cpt equ 4
long
lda ptr,s
sta >ldaadd
sta >offsetline
sta >counter
lda ptr+2,s
and #$00FF
sta >offsetline+2
sta >counter+2
ora #$6B00 ; or rtl
sta >ldaadd+2
lda cpt,s
sta >countline
lda cpt+2,s
sta >countline+2
lda 0,s
sta 8,s ; recup PF
lda 2,s
sta 10,s ; recup bk et Pf
tsc
clc
adc #8 ; remonte 8 le sp
tcs ; new value for stack
phd
phb
phk
plb ; set my data bank
; test si carte active en slot 1
lda >$000000c10c ; adresse signature
and #$00FF ; ecrase le poids fort
cmp #$0031 ; serial card
beq send0
lda #$0003
brl sendf
send0 anop
; test init faite
lda flag
and #$0001
bne send00
lda #$0004
brl sendf
send00 anop
jsl line1 ; init line 1
sendentry anop
; test count line 1 =0
if4<> countline,#0,send01
lda #0 ; no error
brl sendf
; preparation des adresses
send01 anop
lda countline
sec
sbc #1
sta countline
lda countline+2
sbc #0
sta countline+2
lda offsetline
clc
adc countline
sta offset
lda offsetline+2
adc countline+2
sta offset+2
send1 entry
jsl ldalong
sta areg
jsl writechar
if4= counter,offset,send2
lda counter ; adresse = adresse + 1
clc
adc #1
sta counter
lda counter+2
adc #0
sta counter+2
lda counter
sta ldaadd
lda counter+2
and #$00FF
ora #$6B00 ; rtl
sta ldaadd+2
brl send1
send2 anop
lda #0
sendf anop
cmp #1
plb
pld
rtl
*******************************************************************************
* *
* Sendline2 *
* *
* in: 8 octets *
* long pointeur sur buffer de sortie *
* long compteur de caracteres *
* *
* out: no *
* *
* error 5 carte serie non presente en slot 2 *
* error 6 init non faite *
* *
*******************************************************************************
sendline2 entry
ptr2 equ 8
cpt2 equ 4
long
lda ptr2,s
sta >ldaadd
sta >offsetline
sta >counter
lda ptr2+2,s
and #$00FF
sta >offsetline+2
sta >counter+2
ora #$6B00 ; or rtl
sta >ldaadd+2
lda cpt2,s
sta >countline
lda cpt2+2,s
sta >countline+2
lda 0,s
sta 8,s ; recup PF
lda 2,s
sta 10,s ; recup bk et Pf
tsc
clc
adc #8 ; remonte 8 le sp
tcs ; new value for stack
phd
phb
phk
plb ; set my data bank
; test si carte active en slot 2
lda >$000000c20c ; adresse signature
and #$00FF ; ecrase le poids fort
cmp #$0031 ; serial card
beq sendl20
lda #$0005
brl sendf
sendl20 anop
; test init faite
lda flag
and #$0002
bne sendl21
lda #$0006
brl sendf
sendl21 anop
jsl line2 ; init line 2 pointer
brl sendentry
*******************************************************************************
* SOUS-ROUTINES DIVERSES *
*******************************************************************************
;..............................................................................
; sous routine pour acces en long a la table de parametre programme
ldalong anop
dc i1'$AF' ; lda long
ldaadd entry
dc i2'$0'
dc i1'$0'
rtl
;.............................................................................
; initialisation des vecteurs rom pour ligne 1
line1 anop
; vecteur port 1
initvector1 equ $0000C10D
readvector1 equ $0000C10E
writevector1 equ $0000C10F
statusvector1 equ $0000C110
extendvector1 equ $0000C112
initvector2 equ $0000C20D
readvector2 equ $0000C20E
writevector2 equ $0000C20F
statusvector2 equ $0000C210
extendvector2 equ $0000C212
ldx #$00C1 ; MSB for line 1
longa off
sep #$20
lda >initvector1
sta init
stx init+1
lda >readvector1
sta read
stx read+1
lda >writevector1
sta write
stx write+1
lda >statusvector1
sta status
stx status+1
lda >extendvector1
sta extend
stx extend+1
rep #$20
longa on
; set des registres pour firmware call
ldx #$00C1
ldy #$0010
lda #0
stx xreg
sty yreg
sta areg
rtl
;..............................................................................
; initialisation des vecteurs rom pour ligne 2
line2 anop
ldx #$00C2 ; MSB for line 1
longa off
sep #$20
lda >initvector2
sta init
stx init+1
lda >readvector2
sta read
stx read+1
lda >writevector2
sta write
stx write+1
lda >statusvector2
sta status
stx status+1
lda >extendvector2
sta extend
stx extend+1
rep #$20
longa on
ldx #$00C2
ldy #$0020
lda #0
stx xreg
sty yreg
sta areg
rtl
;..............................................................................
; initilisation linex specifiee dans linex
initline anop
pushlong #0 ; space for result
pushlong #0
pushword areg ; a
pushword xreg ; x
pushword yreg ; y
pushword init ; addresse init
_fwentry
initline1 anop
ply
plx
pla
plp
plp
initline2 anop
rtl
;..............................................................................
; ecrit le caractere sur le canal specifier linex
;
writechar anop
; status ??? ready to send char
; c=0 means no c=1 means yes
stat anop
pushlong #0
pushlong #0
pea $0 ; ask if output queue empty
pushword xreg
pushword yreg
pushword status ; push adresse routine
_fwentry
stat1 anop
ply
plx
pla
plp
plp
stat2 anop
bcc stat
send anop
pushlong #0
pushlong #0
pushword areg
pushword xreg
pushword yreg
pushword write ; push adresse routine
_fwentry
ply
plx
pla
plp
plp
rtl
;..............................................................................
; envoie le chaine contenue dans writebuffer avec writelenght de longueur sur
; le canal specifier dans linex
writestring anop
ldx #0 ; counter
writes0 anop
lda writebuffer,x ; recup value
sta areg
phx
jsl writechar
plx
inx
cpx writelenght
bne writes0
ldx #0
rtl
; disable buffering i/o
disabbuff anop
ldx #0
lda ctrcode
sta writebuffer,x
inx
lda #'DB'
sta writebuffer,x
inx
inx
stx writelenght
jsl writestring
rtl
;..............................................................................
******************************************************************************
; zone de data pour serial.s
format dc i2'0'
offsetline dc i4'0' ; offset debut de buffer ligne x
countline dc i4'0' ; compteur ligne x
offset dc i4'0'
counter dc i4'0'
transit dc 8i4'0' ; zone de transit
flag dc i'0' ; flag systeme serial.S
writebuffer ds 16 ; buffer de sortie
writelenght dc i'0' ; compteur octets
ctrcode dc i2'0001' ; octet de travail
; addresse en rom et save de registre
init dc i'0'
read dc i'0'
write dc i'0'
status dc i'0'
extend dc i'0'
areg dc i'0'
xreg dc i'0'
yreg dc i'0'
end