
Ma version que je t'avais précédemment envoyée t'a apparemment aidé ou inspiré

Précision importante: cette routine est pour modèle W et supérieur (écran 240x320)
grosged wrote:@nbenm, pas mal
grosged wrote:Ma version que je t'avais précédemment envoyée t'a apparemment aidé ou inspiré
grosged wrote:Précision importante: cette routine est pour modèle W et supérieur (écran 240x320)
// as -aln -mcpu=arm926ej-s -o .temp.o PrintW.s && objcopy -O binary .temp.o PrintW.prg.tns
.asciz "PRG" @ en-tête "PRG"
push {r0-r12,lr}
bl CLEAR @ efface l'écran
adrl r0,Texte
mov r1,#5 @ coord X
mov r2,#4 @ coord Y
ldr r3,=0b1111111111100000 @ couleur jaune
ldr r4,=0b0000000000011011 @ fond bleu
bl PRINT @ lance l'affichage
mov r1,#0 @ autre coord X
mov r2,#9 @ et Y
bl PRINT
bl PAUSE
pop {r0-r12,pc}
/***************************************************************/
PRINT: cmp r1,#40 @ X>=40 ?
movhs r1,#0 @ alors à zéro
push {r3-r12,lr}
adr r6,SaveX
str r1,[r6] @ mémorise X de départ
mov r5,#480
adrl r8,ATI8x8 @ datas de la fonte
prnewp: cmp r2,#30 @ Y>=30 ?
movhs r2,#29 @ si oui, à 29
mov r9,#0xC0000010
ldr r9,[r9] @ début d'adresse écran
mov r7,#3840
mla r7,r1,r7,r9 @ r7=X*3840+adresse écran...
add r7,r7,r2,lsl#4 @ ...+Y*16=position précise en mém écran
pri_lp: ldrb r9,[r0],#1 @ lis 1 caractère ASCII
cmp r9,#0 @ = 0 ?
popeq {r3-r12,pc} @ alors on arrète!
cmp r9,#124 @ "|" ? (retour à la ligne)
beq retlig @ si oui, on y va!
add r1,r1,#1 @ X=X+1
add r9,r8,r9,lsl#3 @ pointe sur les data adéquats
mov r10,#8 @ val de loop (hauteur)
hbitlp: ldrb r11,[r9],#1 @ 1 ligne de 8bit
lsl r11,r11,#24 @
mov r12,#8 @ val de loop (largeur)
add r6,r7,#2
wbitlp: adds r11,r11,r11 @ état du bit le+à gauche?
strcsh r3,[r7],r5 @=1 alors on écrit
strcch r4,[r7],r5 @=0 alors couleur de fond
subs r12,r12,#1
bne wbitlp
mov r7,r6 @ Repositionne l'adr écran
subs r10,r10,#1 @ pour prochaine ligne à afficher
bne hbitlp @ Quand tout est fait: part 8 pixels
add r7,r7,#3824 @ sur la droite pour prochain caractère!
cmp r1,#40 @ X >=40 ?
bcc pri_lp
ldrb r9,[r0],#1
cmp r9,#124 @ "|" ? (retour à la ligne)
subne r0,r0,#1
retlig: adr r1,SaveX
ldr r1,[r1]
add r2,r2,#1
cmp r9,#0
bne prnewp
pop {r3-r12,pc}
SaveX: .word 0
.align
CLEAR: push {r0-r2,lr}
mov r0,#0xC0000010
ldr r0,[r0]
mov r1,#0
mov r2,#9600
clr_lp: str r1,[r0],#4
subs r2,#1
bne clr_lp
pop {r0-r2,pc}
PAUSE: push {r0,lr}
mov r0,#0x08000000
waitlp: subs r0,#1
bne waitlp
pop {r0,pc}
/***************************************************************/
ATI8x8: .incbin "Bm437ATI8x8.bin"
@ BIG thanks to VileR ( https://int10h.org/oldschool-pc-fonts/ )
@ for these so cool retro fonts!
Texte: .asciz "Bienvenue!|"
.ascii "Hey ! On dirait que ca marche, non ?|Tout va bien?|Alors, c'est OKAY !!|"
.asciz "Qu'est-ce que je pourrais ameliorer..?"
grosged wrote:l'écriture d'un simple octet en mémoire-écran affiche 8 pixels d'un coup !!! (donc , plus la peine de lire chacun des 8 bits de chacun des 8 octets représentant un caractère : un copier/coller suffit
.data
.balign 4
hello1: .asciz "\nHello World!\n"
hello2: .asciz "\nHello TI-Planet!\n"
.text
.global main
.extern printf
.extern SDL_Init
.extern SDL_SetVideoMode
.extern nSDL_LoadFont
.extern SDL_MapRGB
.extern SDL_FillRect
.extern nSDL_DrawString
.extern SDL_Flip
.extern SDL_Delay
.extern SDL_Quit
main:
push {r0-r12, lr}
ldr r0, =hello1
bl printf // par fonction externe
ldr r0, =hello2
svc 10 // par interruption software e_printf
// Initialisation SDL
mov r0,#0x00000020 // SDL_INIT_VIDEO
bl SDL_Init
// Mode vidéo
mov r0,#320
mov r1,#240
mov r2,#16 // Nspire couleur. Sinon mettre 8
mov r3,#0 // SDL_SWSURFACE (surface dans la mémoire système)
bl SDL_SetVideoMode
mov r4,r0 // screen dans r4
// sélection de la police de caractères, et de sa couleur
mov r0,#0 // police NSDL_FONT_THIN
mov r1,#255 // |
mov r2,#255 // | on choisit d'écrire en blanc
mov r3,#255 // |
bl nSDL_LoadFont
mov r5,r0 // font dans r5
// dessin d'un fond d'écran rectangulaire d'une couleur donnée
ldr r0,[r4,#4] // screen format
mov r1,#0 // |
mov r2,#0 // | fond noir
mov r3,#0 // |
bl SDL_MapRGB
mov r6,r0
mov r0,r4 // screen
mov r1,#0
mov r2,r6
bl SDL_FillRect
// dessin de la chaine aux coordonnées indiquées
mov r0,r4
mov r1,r5
mov r2,#100 // |
mov r3,#100 // | coordonnées en pixels
ldr r6,=hello2
str r6,[sp]
bl nSDL_DrawString // On dessine la chaine mais rien n'est visible
// affichage sur l'écran
mov r0,r4 // surface
bl SDL_Flip // Affichage réel sur l'écran
// on temporise (en principe ms d'après SDL_timer.h, mais à vérifier)
mov r0,#0x1000 // temporisation avant de quitter
bl SDL_Delay
// et enfin, on quitte
bl SDL_Quit // on quitte
pop {r0-r12, pc}
Return to Native: Ndless, Linux, ...
Users browsing this forum: ClaudeBot [spider] and 5 guests