La esquina de Geos [Geos Corner]

Cómo contruir una lengüeta (para el nombre de archivo)

How to built a Tab (for the filename)

Fecha [date]: 2002-08-07

En aplicaciones tales como geoWrite (y en geoPaint, geoFile, geoCalc y otras) una vez se selecciona el documento de trabajo, de despliega en la equina superior derecha de la pantalla una lengüeta con el nombre del archivo seleccionado.
A continuación encontrará el código fuente (al estilo de geoProgrammer) y un archivo zip con una demostración de este código (incluye código fuente del demo, encabezado, linker y ejecutable).
Este software es gratuito y puede ser modificado a su gusto. Cualquie comentario es bienvenido.

In applications such as geoWrite (and in geoPaint, geoFile, geoCalc, etc.) once you select a document, in the upper right corner of the screen is displayed a tab with the name of the file.
Next you will find source code (in geoProgrammer style) and a zip file with a demo of this code (includes source code of the demo, header file, linker and executable)
The software is freeware and you can modify as you need. Comments are welcome.

Descargar [download]: tabbuilt.zip (7303 bytes)
 

; Contruir lengueta y visualizar centrada la cadena apuntada por a6
; Built a tab and display centered a string pointed by a6
;
; entrada [input]  a6 := cadena a desplegar [string to display]
;
leftTab    = 210
topTab     = 2
widthTab   = 107
heighTab   = 12
DoTabName:
     LoadW r0,#TabGraphics
     jsr GraphicsString
     jsr LenPxString
     MoveW r0,pxinstring
     lda #' '          ; espacio [space]
     ldx #0            ; plaintext
     jsr GetRealSize
     clc
     tya               ; character width
     asl a
     adc r0L           ; adicionar longitud al total (add lenght to total)
     sta r0L
     bcc 20$
     inc r0H
20$  sec
     lda #<widthTab
     sbc r0L        ; al ancho restar longitud string (substract from width)
     sta r11L
     lda #>widthTab
     sbc r0H
     sta r11H

     lsr r11H             ; dividir por 2 (divide by 2)
     ror r11L
     AddVW leftTab,r11    ; agregar lado izquierdo (left side)
     LoadB r1H,topTab+8   ; baseline
     lda #' '             ; agregar ESPACIO al lado izquierdo (SPACE at left side)
     jsr PutChar
     MoveW a6,r0
     jsr PutString
     lda #' '             ; agregar ESPACIO al lado derecho (SPACE at right side)
     jsr PutChar
     rts

; tabla para que dibuja la lengüeta
; table with the tab draw commands
TabGraphics:
     .byte NEWPATTERN,0
     .byte MOVEPENTO
     .word leftTab+3
     .byte topTab
     .byte RECTANGLETO
     .word leftTab+widthTab-3
     .byte topTab+2

     .byte MOVEPENTO
     .word leftTab
     .byte topTab+3
     .byte RECTANGLETO
     .word leftTab+widthTab
     .byte topTab+heighTab
 
     .byte NEWPATTERN,$FF
     .byte MOVEPENTO
     .word leftTab+2
     .byte topTab
     .byte LINETO
     .word leftTab+widthTab-2
     .byte topTab

     .byte MOVEPENTO
     .word leftTab
     .byte topTab+2
     .byte LINETO
     .word leftTab+widthTab
     .byte topTab+2

     .byte MOVEPENTO
     .word leftTab
     .byte topTab+4
     .byte LINETO
     .word leftTab+widthTab
     .byte topTab+4

     .byte MOVEPENTO
     .word leftTab
     .byte topTab+6
     .byte LINETO
     .word leftTab+widthTab
     .byte topTab+6

     .byte MOVEPENTO
     .word leftTab
     .byte topTab+8
     .byte LINETO
     .word leftTab+widthTab
     .byte topTab+8

     .byte MOVEPENTO
     .word leftTab
     .byte topTab+10
     .byte LINETO
     .word leftTab+widthTab
     .byte topTab+10

     .byte MOVEPENTO
     .word 0
     .byte topTab+12
     .byte LINETO
     .word 319
     .byte topTab+12
     .byte NULL

; Calcular la longitud en pixeles de un string de maximo 255 carateres
; calculate the leght in pixels of a string up to 255 characters
; entrada    a6 := apuntador a un string con terminacion nulo (pointer to a null terminated string)
; salida     r0 := longitud en pixels (16 bits) [lenght in pixels (16bits)]
LenPxString:
     lda #0
     sta r0L     ; lenght cero
     sta r0H
     sta r2      ; r2:=0
10$  ldy r2
     lda (a6),y
     beq 30$    ; fin del string [end of string]
     ldx #0     ; plaintext
     jsr GetRealSize
     clc
     tya     ; caracter width
     adc r0L     ; adicionar longitud al total
     sta r0L
     bcc 20$
     inc r0H
20$  inc r2
     bne 10$
30$  rts
 



Indice de la Esquina Geos (go to Geos Corner's index)

páginas creadas por [pages by]: Alvaro ALONSO_G.
correo electrónico [email]: [email protected]
 2002-08-07, creación de esta página (created on)
  1