develop/examples/cpuspeed: Post-SVN tidy

- Move source code from `trunk` into program root directory.
- Update build files and ASM include paths.
- Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden.
This commit is contained in:
2025-05-22 13:50:27 +01:00
parent 5db678854f
commit 92b71dacb2
4 changed files with 129 additions and 127 deletions

View File

@@ -1,5 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../.." or tup.getconfig("HELPERDIR") HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua") tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir()) add_include(tup.getvariantdir())

View File

@@ -1,126 +1,128 @@
; ; SPDX-License-Identifier: NOASSERTION
; CPU SPEED INDICATIOR ;
;
; Compile with FASM ;
; ; CPU SPEED INDICATIOR
;
use32 ; Compile with FASM
org 0x0 ;
db 'MENUET01' ; 8 byte id use32
dd 0x01 ; header version org 0x0
dd START ; start of code
dd I_END ; size of image db 'MENUET01' ; 8 byte id
dd 0x1000 ; memory for app dd 0x01 ; header version
dd 0x1000 ; esp dd START ; start of code
dd 0x0,0x0 ; I_Param , I_Icon dd I_END ; size of image
dd 0x1000 ; memory for app
include 'lang.inc' dd 0x1000 ; esp
include '..\..\..\..\macros.inc' dd 0x0,0x0 ; I_Param , I_Icon
START: ; start of execution include 'lang.inc'
include '..\..\..\macros.inc'
mov eax,18
mov ebx,5 START: ; start of execution
mcall
mov eax,18
xor edx,edx mov ebx,5
mov ebx,1000000 mcall
div ebx
mov ebx,10 xor edx,edx
mov edi,text+19 mov ebx,1000000
mov ecx,5 div ebx
newnum: mov ebx,10
xor edx,edx mov edi,text+19
mov ebx,10 mov ecx,5
div ebx newnum:
add dl,48 xor edx,edx
mov [edi],dl mov ebx,10
sub edi,1 div ebx
loop newnum add dl,48
mov [edi],dl
mov eax,48 sub edi,1
mov ebx,3 loop newnum
mov ecx,sc
mov edx,sizeof.system_colors mov eax,48
mcall mov ebx,3
mov ecx,sc
red: mov edx,sizeof.system_colors
call draw_window ; at first, draw the window mcall
still: red:
call draw_window ; at first, draw the window
mov eax,10 ; wait here for event
mcall still:
cmp eax,1 ; redraw request ? mov eax,10 ; wait here for event
jz red mcall
cmp eax,2 ; key in buffer ?
jz key cmp eax,1 ; redraw request ?
cmp eax,3 ; button in buffer ? jz red
jz button cmp eax,2 ; key in buffer ?
jz key
jmp still cmp eax,3 ; button in buffer ?
jz button
key: ; key
mov eax,2 ; just read it and ignore jmp still
mcall
jmp still key: ; key
mov eax,2 ; just read it and ignore
button: ; button mcall
mov eax,17 ; get id jmp still
mcall
button: ; button
cmp ah,1 ; button id=1 ? mov eax,17 ; get id
jnz still mcall
or eax,-1 ; close this program
mcall cmp ah,1 ; button id=1 ?
jnz still
or eax,-1 ; close this program
; ********************************************* mcall
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
draw_window: ; *********************************************
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw draw_window:
mcall
mov eax,12 ; function 12:tell os about windowdraw
; DRAW WINDOW mov ebx,1 ; 1, start of draw
mov eax,0 ; function 0 : define and draw window mcall
mov ebx,100*65536+200 ; [x start] *65536 + [x size]
mov ecx,100*65536+65 ; [y start] *65536 + [y size] ; DRAW WINDOW
mov edx,[sc.work] ; color of work area RRGGBB,8->color glide mov eax,0 ; function 0 : define and draw window
or edx,0x33000000 ; color of grab bar RRGGBB,8->color mov ebx,100*65536+200 ; [x start] *65536 + [x size]
mov edi,title ; WINDOW LABEL mov ecx,100*65536+65 ; [y start] *65536 + [y size]
mcall mov edx,[sc.work] ; color of work area RRGGBB,8->color glide
or edx,0x33000000 ; color of grab bar RRGGBB,8->color
mov edi,title ; WINDOW LABEL
mov ebx,20*65536+14 ; draw info text with function 4 mcall
mov ecx,[sc.work_text]
mov edx,text
mov esi,24 mov ebx,20*65536+14 ; draw info text with function 4
mov eax,4 mov ecx,[sc.work_text]
mcall mov edx,text
mov esi,24
mov eax,12 ; function 12:tell os about windowdraw mov eax,4
mov ebx,2 ; 2, end of draw mcall
mcall
mov eax,12 ; function 12:tell os about windowdraw
ret mov ebx,2 ; 2, end of draw
mcall
; DATA AREA ret
text: ; DATA AREA
db 'CPU RUNNING AT MHZ'
title db 'CPU SPEED',0 text:
db 'CPU RUNNING AT MHZ'
I_END:
title db 'CPU SPEED',0
sc system_colors
I_END:
sc system_colors