Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - MrApplecraft

Pages: [1]
1
[DE] Andere Programmierthemen und -hilfe / Programm um Texte anzuzeigen.
« on: January 08, 2017, 12:27:21 pm »
Hi Leute,
vor einiger Zeit hab ich angefangen Assembler zu lernen und wollte jetzt ein Programm programmieren, das mir "Karten" anzeigt, die man umblättern kann.
Leider ist mir ürgentwann aufgefallen wie groß der Code wird, hat jemand Tipps wie man den kleiner bekommt und den Text in einen Buffer bekommt?

Code: [Select]
KeyLoop:
ld a, $FF ;Reset the keypad.
out (1), a
ld a, $FE ;Select group.
out (1), a
in a, (1) ;Test for keys.
cp $FD
jr z, Butleft
cp $FB
jr z, Butright

ld a, $FF ;Reset the keypad.
out (1), a
ld a, $FD ;Select group.
out (1), a
in a, (1) ;Test for keys.
cp $BF
jr z, Getthehelloutofhere

jr KeyLoop

Butright:
    ld a,b
    cp 3        ; Don't increment B if it's at its maximum value.
    jr z, KeyLoop ;Gerade 3 Weil wir nicht mehr als 2 tabs haben
    inc B
cp 2
jp z,Txt2
jp KeyLoop

Butleft:
    ld a,b
    cp 0          ; Don't decrement B if it's at its minimum value.
    jr z, KeyLoop
    dec b
cp 1
jp z,About
jp KeyLoop

Getthehelloutofhere:
call _GrBufClr
call _bufclear
call _homeup
call _clrscrnfull
call _eraseeol
ret

;Txt2
;Draws first "Tab"
Txt2:
push bc
ld hl,Texteins1
call Drawsmalltext
call Deinvert
ld hl,Texteins2
call Drawsmalltext
ld hl,Texteins3
call Drawsmalltext
ld hl,Texteins4
call Drawsmalltext
ld hl,Texteins5
call Drawsmalltext
ld hl,Texteins6
call Drawsmalltext
ld hl,Texteins7
call Drawsmalltext
ld hl,Texteins8
call Drawsmalltext
ld hl,Texteins9
call Drawsmalltext
ld hl,Texteins10
call Drawsmalltext
pop bc
jp KeyLoop
;About
;Draws the Text for the Aboutscreen
About:
push BC
call Rahmen
ld a,$0C
call FastHorizLine
ld a,$0D
call FastHorizLine
call _GRBUFCPY
pop BC
call Invert
push bc
ld d,0
ld b,0
ld hl,Abouttxt1
call Drawsmalltext

ld b,$06
ld hl,Abouttxt2
call Drawsmalltext

call Deinvert

ld b,$02
ld a,$02
call LoadintoD
ld hl,Abouttxt3
call Drawsmalltext

ld hl,Abouttxt4
call Drawsmalltext

ld hl,Abouttxt5
call Drawsmalltext

ld hl,Abouttxt6
call Drawsmalltext

ld a,$12
call LoadintoD
ld hl,Abouttxt7
call Drawsmalltext
pop bc
jp KeyLoop
;Drawsmalltext
;Input: Pointer to text in HL
;Input: PenRow in D
;Input: PenCol in B
;Output: $06 added to D, Displays HL
;Destroys: ?

Drawsmalltext:
ld a,d
ld (PENROW),a
ld a,b
ld (PENCOL),a
push de
call _vputs
pop de
ld a,$06
call LoadintoD
ret

;LoadintoD
;Input: A
;Output: Adds A to D

LoadintoD:
add a,d
ld d,a
ret
Invert:
set textInverse, (iy+textflags)
ret

Deinvert:
res textInverse, (iy+textflags)
ret
Texteins1:
.db " Text",0
Texteins2:
.db "Text2",0
Texteins3:
.db "Text3",0
Texteins4:
.db "Text4",0
Texteins5:
.db "Text5",0
Texteins6:
.db "Text6",0
Texteins7:
.db "Text7",0
Texteins8:
.db "Text8",0
Texteins9:
.db "Text9",0
Texteins10:
.db "Text10",0

.end

Pages: [1]